File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,18 @@ func (n *fsNode) Path() string {
101101// result of filepath.Split.
102102func mySplit (s string ) (string , string ) {
103103 dName , fName := filepath .Split (s )
104- return StripTrailingSeps (dName ), fName
104+ dName = StripTrailingSeps (dName )
105+
106+ // Prevent infinite recursion on Windows when dealing with volume names
107+ // or paths that don't split properly. If after stripping separators,
108+ // dName is the same as the input s, it means filepath.Split didn't
109+ // actually split anything meaningful (e.g., "C:" on Windows).
110+ // In this case, treat the entire string as the filename.
111+ if dName == s {
112+ return "" , s
113+ }
114+
115+ return dName , fName
105116}
106117
107118func (n * fsNode ) addFile (name string , c []byte ) (result * fsNode , err error ) {
You can’t perform that action at this time.
0 commit comments