Skip to content
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

Merged
merged 5 commits into from
Sep 8, 2020

Conversation

jsonsivar
Copy link
Contributor

Change Log

  • For creating mirror file, use targetBucketPath instead of targetPath so we don't pass in emtpy string for root files
  • Pass paths in as a pointer so ShareFilesViaPublicKey can modify it for enhancing data
  • Another dbid casting error
  • For FindMirrorFileByPathAndBucketSlug don't return empty struct so nil could be checked for when trying to create
  • Handle file already exists for mirror file collection insert

Copy link
Contributor

@perfectmak perfectmak left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsonsivar

I wonder: should we return err or just return mf, nil?

Copy link
Contributor Author

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.

core/textile/bucket_factory.go Show resolved Hide resolved
Copy link
Contributor

@dmerrill6 dmerrill6 left a 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

core/space/services/services_sharing.go Outdated Show resolved Hide resolved
}

if path.Bucket == "" || path.Bucket == t.GetDefaultBucketSlug() {
if ep.Bucket == "" || ep.Bucket == t.GetDefaultBucketSlug() {
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsonsivar

Not sure if I understand. Do you mean adding a prefix, eg: shared_, personal_?

Copy link
Contributor Author

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).

@jsonsivar jsonsivar merged commit f377773 into alpha-release-dev Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants