-
Notifications
You must be signed in to change notification settings - Fork 44
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
Hotfix/sharing: some more bugs with sharing and mirror file creation #161
Conversation
… this should be a working happy 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.
LGTM! I left a comment
@@ -226,11 +226,12 @@ func (s *Space) OpenSharedFile(ctx context.Context, hash, password, filename str | |||
}, nil | |||
} | |||
|
|||
func (s *Space) ShareFilesViaPublicKey(ctx context.Context, paths []domain.FullPath, pubkeys []crypto.PubKey) error { | |||
func (s *Space) ShareFilesViaPublicKey(ctx context.Context, paths *[]domain.FullPath, pubkeys []crypto.PubKey) error { |
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.
Maybe add a comment on this function that paths
would be modified. Personally, I think it would have been better if the function returned the modified paths
instead of mutating the input value, but eitherways a comment should help make it more apparent.
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.
Fixed in 26a4678.
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if mf != nil { | ||
return nil, errMirrorFileAlreadyExists |
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 wonder: should we return err
or just return mf, nil
?
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.
Will leave this as-is for now and can update later since it's working at least. If we need a create or get type usage if this later we can always update.
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.
LGTM, left some minor questions
} | ||
|
||
if path.Bucket == "" || path.Bucket == t.GetDefaultBucketSlug() { | ||
if ep.Bucket == "" || ep.Bucket == t.GetDefaultBucketSlug() { |
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.
Do shared with me files have ep.Bucket == ""
? Because if that's the case it might unintendedly fall into this block for shared-with-me files
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.
So shared with me files will always have a bucket name. But the weird part is that the mirror bucket name is also called personal
so it would erroneous fall into the second clause. I made both clauses so that it would default to the personal bucket if it was empty or if personal
was supplied explicitly. For now I'm thinking to keep it clean we can change the name of the mirrored buckets to something like shared
so it doesn't fall into this.
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.
@maurycy do you see any issues with this idea? Like if I used personal_mirror
for the mirror bucket names. As long as we are not referring the mirror bucket name hardcoded as personal
elsewhere that should be fine.
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.
Not sure if I understand. Do you mean adding a prefix, eg: shared_
, personal_
?
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.
Fixed in 1742bb0. Mirror buckets now use a different name so it wouldn't fall into this slot unless it was actually a personal bucket (or empty in which case it is personal).
Change Log
targetBucketPath
instead oftargetPath
so we don't pass in emtpy string for root filespaths
in as a pointer soShareFilesViaPublicKey
can modify it for enhancing dataFindMirrorFileByPathAndBucketSlug
don't return empty struct so nil could be checked for when trying to create