Skip to content

FullFileExtension of report. is "." (and of archive.tar. is ".tar.") while FileExtension is "", though the docs say they follow the same rules #542

Closed

Description

@matt-edmondson

What's wrong

In Semantics.Paths/SemanticFilePath.cs:

  • FileExtension treats a trailing dot as no extension (lastDotIndex == path.Length - 1 returns ""). WeakStringWithoutExtension and RemoveExtension() follow the same rule.
  • FullFileExtension returns everything from the first dot after the name's first character, and has no trailing-dot check. Its <remarks> says it "follows the same rules as FileExtension".

Failure scenario

Observed on Linux, net10.0:

Path FileExtension FullFileExtension RemoveExtension()
/home/u/report. '' '.' /home/u/report
/home/u/archive.tar. '' '.tar.' /home/u/archive.tar
/home/u/.bashrc. '' '.' /home/u/.bashrc
/home/u/archive.tar.gz .gz .tar.gz (correct)

A bare "." is reported as a file extension, and .tar. keeps its trailing dot. Code that dispatches on FullFileExtension therefore gets a different answer from code that uses FileExtension for the same file. Expected: report. and .bashrc. have no full extension, and archive.tar. gives .tar, consistent with how FileExtension treats the trailing dot.

Suggested fix / acceptance criteria

  • FullFileExtension ignores a trailing dot, the same way FileExtension and WeakStringWithoutExtension do.
  • Tests pin the three trailing-dot rows above, for both absolute and relative file paths.

Activity

  1. added
    bug
    on Nov 7, 2026
  2. matt-edmondson commented on Nov 7, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions