Repository navigation
s3: implement link sharing - #4280
Conversation
|
I think this code looks fine! I will give a detailed review when I've finished getting the 1.52 release out so apologies for the delay... |
ncw
left a comment
There was a problem hiding this comment.
Nice feature - thank you :-)
See inline for comments.
ncw
left a comment
There was a problem hiding this comment.
See comments inline!
You need to fix up the tests too - that is why the build is breaking.
There was a problem hiding this comment.
This should default to very large to be compatible with previous rclone versions - say 100 years!
Also using a type of fs.Duration here will give the user more options when configuring it including days, weeks absolute times etc! You'll need to cast it back to time.Duration for the call.
expire = fs.Duration(time.Hour * 24 * 365 * 100)
There was a problem hiding this comment.
This needs a "Note: not all backends support this flag - if the backend doesn't support it then the link returned won't expire."
There was a problem hiding this comment.
This needs a similar note: Not all backends support --unlink - those that don't will just ignore it.
There was a problem hiding this comment.
I'd just call this in rcPublicLink
unlink, _ = in.GetBool("unlink")You don't want to give an error if the user doesn't pass the parameter you want it to default to false.
Likewise the expire parameter - missing should mean very large.
There was a problem hiding this comment.
Can you move this to fs/rc/params.go and call it GetDuration and change it so it only reads a duration. This could do with a test too in fs/rc/params_test.go
ncw
left a comment
There was a problem hiding this comment.
I think that looks great now - thank you :-)
Can you squash it into two commits (in this order)
- Add extra fields to PublicLink interface and consequent changes
- The changes to the s3 backend "s3: implement link sharing"
Then I'll merge it - thank you :-)
This adds expire and unlink fields to the PublicLink interface. This fixes up the affected backends and removes unlink parameters where they are present.
ncw
left a comment
There was a problem hiding this comment.
That looks great thanks!
I've just given the docs and the commit messages a bit of a tweak then I'll merge.
Thank you very much - great feature :-)
Ignoring these options silently seems a bit risky. Wouldn't it be more appropriate to error out for backends without support (in addition to if a supporting backend responds with an error)? |
I agree, but it is a lot more work to do that. It would require error checking in all the backends which implement |
What is the purpose of this change?
Add link sharing to S3
Was the change discussed in an issue or in the forum before?
#2178
Checklist