You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows certain filenames are forbidden like CON.
jgit validates the file paths and throws an exception if it is not valid.
In my case the filepath is src/Con.java, where Con.java is a file and src is a folder.
The validation code does not seem to consider the file extension.
The filename Con.java is a valid file on windows: CON (without any extension) is considered invalid:
Actual behavior
org.eclipse.jgit.dircache.InvalidPathException: Invalid path: src/Con.java
at org.eclipse.jgit.dircache.DirCacheCheckout.checkValidPathSegment(DirCacheCheckout.java:1609)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkValidPath(DirCacheCheckout.java:1598)
at org.eclipse.jgit.dircache.DirCacheCheckout.processEntry(DirCacheCheckout.java:387)
at org.eclipse.jgit.dircache.DirCacheCheckout.prescanOneTree(DirCacheCheckout.java:354)
at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:512)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:480)
...
Caused by: org.eclipse.jgit.errors.CorruptObjectException: invalid name 'CON'
at org.eclipse.jgit.lib.ObjectChecker.report(ObjectChecker.java:781)
at org.eclipse.jgit.lib.ObjectChecker.checkNotWindowsDevice(ObjectChecker.java:1029)
at org.eclipse.jgit.lib.ObjectChecker.checkPathSegment2(ObjectChecker.java:903)
at org.eclipse.jgit.lib.ObjectChecker.checkPathSegment(ObjectChecker.java:849)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkValidPathSegment(DirCacheCheckout.java:1606)
... 45 more
Expected behavior
No crash
Relevant log output
No response
Other information
No response
The text was updated successfully, but these errors were encountered:
Not sure why one would want to prevent cloning of these files, they are perfectly valid.
An option to disable these checks would have been nice... Overriding the SystemReader to return false for windows is technically an option, but it does not work because then the code will try to set posix properties on the file...
Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM¹, COM², COM³, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT¹, LPT², and LPT³. Also avoid these names followed immediately by an extension; for example, NUL.txt and NUL.tar.gz are both equivalent to NUL. For more information, see Namespaces.
Version
7.1.0.202411261347-r
Operating System
Windows
Bug description
On Windows certain filenames are forbidden like
CON
.jgit validates the file paths and throws an exception if it is not valid.
In my case the filepath is
src/Con.java
, whereCon.java
is a file andsrc
is a folder.The validation code does not seem to consider the file extension.
The filename
Con.java
is a valid file on windows:CON
(without any extension) is considered invalid:Actual behavior
Expected behavior
No crash
Relevant log output
No response
Other information
No response
The text was updated successfully, but these errors were encountered: