aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2025-03-30 13:51:08 +0800
committerGitHub <noreply@github.com>2025-03-30 05:51:08 +0000
commit5a9b3bfa50ff45c65d8d1b17ad960fb05f38ef84 (patch)
tree4d8f5aaa792e1515837b852e57a5b7bd6a9a47e5
parentdd901983c0a3a6087f6a83f95453f4f484bc0ff0 (diff)
downloadgitea-5a9b3bfa50ff45c65d8d1b17ad960fb05f38ef84.tar.gz
gitea-5a9b3bfa50ff45c65d8d1b17ad960fb05f38ef84.zip
add additional ReplaceAll in pathsep to cater for different pathsep (#34061) (#34070)
Backport #34061 by eeyrjmr 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: JonRB <4564448+eeyrjmr@users.noreply.github.com>
-rw-r--r--services/doctor/storage.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/doctor/storage.go b/services/doctor/storage.go
index 3f3b562c37..77fc6d65df 100644
--- a/services/doctor/storage.go
+++ b/services/doctor/storage.go
@@ -121,7 +121,7 @@ func checkStorage(opts *checkStorageOptions) func(ctx context.Context, logger lo
storer: storage.LFS,
isOrphaned: func(path string, obj storage.Object, stat fs.FileInfo) (bool, error) {
// The oid of an LFS stored object is the name but with all the path.Separators removed
- oid := strings.ReplaceAll(path, "/", "")
+ oid := strings.ReplaceAll(strings.ReplaceAll(path, "\\", ""), "/", "")
exists, err := git.ExistsLFSObject(ctx, oid)
return !exists, err
},