-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
add additional ReplaceAll in pathsep to cater for different pathsep #34061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3e9afcd
to
c28a152
Compare
services/doctor/storage.go
Outdated
@@ -121,7 +121,8 @@ 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, "/", "") | |||
oidUnix := strings.ReplaceAll(path, "/", "") | |||
oid := strings.ReplaceAll(oidUnix, "\\", "") // strip windows separator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about strings.Join(filepath.SplitList(path), "")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I understand that function correctly, its splits on the OS $PATH seperator (ie : for unix) not of the path delimiter (ie /)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c28a152
to
b8a6f75
Compare
b8a6f75
to
a02b7ce
Compare
This is more complicated. If lfs object stored in disk, the splitter is different from different OS. If it's stored in S3 compatiable service, it should be always splitted with |
cccdee1
to
bb7014a
Compare
…o-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]>
…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 <[email protected]>
* giteaofficial/main: [skip ci] Updated translations via Crowdin Add toggleClass function in dom.ts (go-gitea#34063) Add a config option to block "expensive" pages for anonymous users (go-gitea#34024) add additional ReplaceAll in pathsep to cater for different pathsep (go-gitea#34061) [skip ci] Updated translations via Crowdin enable staticcheck QFxxxx rules (go-gitea#34064) update to golangci-lint v2 (go-gitea#34054) Add descriptions for private repo public access settings and improve the UI (go-gitea#34057) Add anonymous access support for private/unlisted repositories (go-gitea#34051) Hide activity contributors, recent commits and code frequrency left tabs if there is no code permission (go-gitea#34053) Update action status badge layout (go-gitea#34018) Add anonymous access support for private repositories (backend) (go-gitea#33257) Simplify emoji rendering (go-gitea#34048) Adjust the layout of the toolbar on the Issues/Projects page (go-gitea#33667) Fix bug on downloading job logs (go-gitea#34041) Fix git client accessing renamed repo (go-gitea#34034) Decouple Batch from git.Repository to simplify usage without requiring the creation of a Repository struct. (go-gitea#34001) fix org repo creation being limited by user limits (go-gitea#34030) Fix the issue with error message logging for the `check-attr` command on Windows OS. (go-gitea#34035) Try to fix check-attr bug (go-gitea#34029)
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