Skip to content

Commit d7a6133

Browse files
eeyrjmrGiteaBot
andauthored
add additional ReplaceAll in pathsep to cater for different pathsep (#34061)
The doctor storage check reconstructs the lfs oid by producing a string where the path separator is stripped ab/dc/efg -> abdcefg. Windows however uses a backslash and thus the ReplaceAll call doesn't produce the correct oid resulting in all lfs objects being classed as orphaned. This PR allows this to be more OS agnostic. Closes #34039 --------- Co-authored-by: Giteabot <[email protected]>
1 parent 0b847f4 commit d7a6133

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/doctor/storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func checkStorage(opts *checkStorageOptions) func(ctx context.Context, logger lo
121121
storer: storage.LFS,
122122
isOrphaned: func(path string, obj storage.Object, stat fs.FileInfo) (bool, error) {
123123
// The oid of an LFS stored object is the name but with all the path.Separators removed
124-
oid := strings.ReplaceAll(path, "/", "")
124+
oid := strings.ReplaceAll(strings.ReplaceAll(path, "\\", ""), "/", "")
125125
exists, err := git.ExistsLFSObject(ctx, oid)
126126
return !exists, err
127127
},

0 commit comments

Comments
 (0)