Skip to content

Commit 72cfa46

Browse files
eeyrjmrGiteaBot
andcommitted
add additional ReplaceAll in pathsep to cater for different pathsep (go-gitea#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 go-gitea#34039 --------- Co-authored-by: Giteabot <[email protected]>
1 parent dd90198 commit 72cfa46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/doctor/storage.go

Lines changed: 1 addition & 1 deletion
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)