-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix minio storage iterator path #24691
Conversation
Are there any features affected by this? |
Interfaces should have the same behaviors. |
ps: I guess we need some common test code for different storages, to make sure they behave consistently |
I think there are no affects. All are |
There is a test |
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.
tests needed.
How about using a common function to test all storages? Then it could guarantee that they have the consistent behavior. ps: when rewriting the queue, I introduced a general test function, then all queues are tested by it, so all queues should have the same behavior now |
modules/storage/minio.go
Outdated
p = strings.TrimPrefix(p, "/") // url path prefix should not start with / | ||
return util.PathJoinRelX(m.basePath, p) |
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.
I think util.PathJoinRelX
already removes the prefix slash. no need to trim it ahead?
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 p = "/"
and m.base = ""
, it generates "./" which is invalid to minio api, shows Received unexpected error: Object name cannot be empty
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.
Nope, it never generates "./" here.
See the comment of "PathJoinRel" family functions, it only outputs "", "." or "foo/bar" path
Even if you trim "/" here, if the input p is "./" , you still get "." and later your code append another suffix slash.
So ideally, I think it should be:
p = util.PathJoinRelX(m.basePath, p)
if p == "." { p = "" } // minio doesn't use dot as relative path
return p
I guess there could be a test case for it.
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 p == "." { p = "" }
is ok
I was unable to create a backport for 1.19. @fuxiaohei, please send one manually. 🍵
|
Since v1.19 hasn't prefix, it's unnecessary to backport. |
* upstream/main: (30 commits) Don't filter action runs based on state (go-gitea#24711) Add Go package registry (go-gitea#24687) Fix flash of unstyled content in action view page (go-gitea#24712) Clean up various avatar dimensions (go-gitea#24701) Remove the parallelizing when loading repo for dashboard (go-gitea#24705) Optimize actions list by removing an unnecessary `git` call (go-gitea#24710) Update cron-translations.yml (go-gitea#24708) Fix run list broken when trigger user deleted (go-gitea#24706) Remove Fomantic comment module (go-gitea#24703) Update to Alpine 3.18 (go-gitea#24700) fix minio storage iterator path (go-gitea#24691) Add status indicator on main home screen for each repo (go-gitea#24638) Add test for api team orgnization (go-gitea#24699) Improve button-ghost, remove tertiary button (go-gitea#24692) Add icon support for safari (go-gitea#24697) Improve avatar uploading / resizing / compressing, remove Fomantic card module (go-gitea#24653) Fix docs documenting invalid `@every` for `OLDER_THAN` cron settings (go-gitea#24695) Fix `organization` field being `null` in `GET /api/v1/teams/{id}` (go-gitea#24694) Use standard HTTP library to serve files (go-gitea#24693) Add `eslint-plugin-eslint-comments` (go-gitea#24690) ...
@fuxiaohei @lunny I think this broke local tests at least for me - when they are run locally here is what I get consistently when I run Can we modify the standard testing that it avoids running minio test if no minio? May be to run this test
to run tests I clone a fresh copy of repo and then:
|
Fix #24691 (comment) --------- Co-authored-by: silverwind <me@silverwind.io>
minio storage iterator shows different behavior with local fs iterator.
in local fs storage:
in minio storage:
I think local fs is correct, minio use wrong
basePath
to trim storage path prefix.