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

Add missing expiry in shares #3895

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-missing-expiry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Add missing expiry date to shares

We have added expiry dates to the shares

https://github.com/cs3org/reva/pull/3895
https://github.com/owncloud/ocis/issues/5442
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,22 @@ func (h *Handler) createCs3Share(ctx context.Context, w http.ResponseWriter, r *
}
}

expiry := r.PostFormValue("expireDate")
if expiry != "" {
ts, err := time.Parse("2006-01-02T15:04:05-0700", expiry)
if err != nil {
return nil, &ocsError{
Code: response.MetaBadRequest.StatusCode,
Message: "could not parse expiry timestamp on this item",
Error: err,
}
}
req.Grant.Expiration = &types.Timestamp{
Seconds: uint64(ts.Unix()),
Nanos: 0,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is utils.TimeToTS which could do this for you. But not critical.

Copy link
Author

Choose a reason for hiding this comment

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

Thx, did not know that, incorporated it.

}

createShareResponse, err := client.CreateShare(ctx, req)
if err != nil {
return nil, &ocsError{
Expand Down