Test Windows <reserved>.middle.extension
filenames
#1844
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I believe the implementation of
gix-validate
currently covers all modified cases of Windows reserved device names likeNUL
, for each name it recognizes as reserved when unmodified. But there is one common variation we didn't have test cases for: paths likeNUL.tar.xz
where the reserved device name is followed by something that is not technically an extension. The Windows filename extension inNUL.tar.xz
isxz
rather thantar.xz
:As detailed in f5ef10d, the implementation covers this already by looking to see if the reserved name has a
.
(among other patterns) after it, regardless of what comes after the.
, but this seems valuable to test because it is a case that is sometimes inadvertently not covered in implementations of the Windows path rules, so a regression in this area is possible if the implementation ingix-validate
is ever substantially altered.We did have tests already of related cases, such as paths where the reserved name is followed by multiple dots separated by spaces. But it seems to me that those preexisting cases--while important in their own right--neither express nor guard against the simpler case of a path like
NUL.tar.xz
.Besides that, this PR includes two other changes: existing tests in the same file of paths containing
\
characters are changed to use raw literals so it is clearer if and how many times the backslashes are repeated (6daaba3) and, least importantly, more UNC-style paths are tested to avoid conveying the impression that\\
would only be rejected in\\?\
(eaa59a3).