-
Notifications
You must be signed in to change notification settings - Fork 367
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
3085 lakectl ingest adds multiple excess slash to object name #3108
3085 lakectl ingest adds multiple excess slash to object name #3108
Conversation
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.
Thanks for this fix! Looking to see the tests, but probably not part of this PR.
See my 2 comments
cmd/lakectl/cmd/store/s3.go
Outdated
@@ -31,6 +31,10 @@ func (s *S3Walker) Walk(ctx context.Context, storageURI *url.URL, walkFn func(e | |||
var continuation *string | |||
const maxKeys = 1000 | |||
prefix := strings.TrimLeft(storageURI.Path, "/") | |||
var trimPrefix string | |||
if idx := strings.LastIndex(prefix, "/"); idx != -1 { | |||
trimPrefix = prefix[:idx+1] |
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.
It took me some time to understand why this is the right value, it's based on the ObjectStoreEntry
definition:
// RelativeKey represents a path relative to prefix (or directory). If none specified, will be identical to FullKey
Would you mind adding a comment explaining the trimPrefix
part?
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.
Done
3de4fcf
to
4796114
Compare
Please rebase on |
Co-authored-by: itaiad200 <itaiad200@gmail.com>
1a65f03
to
15830eb
Compare
Co-authored-by: johnnyaug <yoni.augarten@treeverse.io>
Co-authored-by: johnnyaug <yoni.augarten@treeverse.io>
Fixed
ingest
function not to add a"/"
if the to path ends wirh rhe branch name (and thus ends with"/"
)Fixed
S3
Walk
to correctly trim prefixes: with"/"
if exists, and partial prefixes tooTested manually with
--from
s3:://mybucket/data/
,s3:://mybucket/data
ands3:://mybucket/da
Opened #3109 for adding tests