diff --git a/changelog/unreleased/fix-missing-expiry.md b/changelog/unreleased/fix-missing-expiry.md new file mode 100644 index 0000000000..9c09d78552 --- /dev/null +++ b/changelog/unreleased/fix-missing-expiry.md @@ -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 \ No newline at end of file diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index fea5f61478..54babc0f21 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -1411,6 +1411,19 @@ 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 = utils.TimeToTS(ts) + } + createShareResponse, err := client.CreateShare(ctx, req) if err != nil { return nil, &ocsError{