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

Respect empty expiryDate value in server #44485

Merged
merged 3 commits into from
May 23, 2024

Conversation

nfebe
Copy link
Contributor

@nfebe nfebe commented Mar 26, 2024

If expireDate is an empty string and not null then the server should not set a default.

Resolves : #44219

Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

@nfebe
Copy link
Contributor Author

nfebe commented Apr 30, 2024

Related changes : #44912

@nfebe nfebe force-pushed the 44219-share-server-respect-empty-expiry-date branch 2 times, most recently from be0e0fc to dbb802a Compare April 30, 2024 10:54
@nfebe nfebe changed the title WIP : Respect empty expiryDate value in server Respect empty expiryDate value in server Apr 30, 2024
@nfebe nfebe marked this pull request as ready for review April 30, 2024 11:20
@nfebe nfebe added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 30, 2024
@nfebe
Copy link
Contributor Author

nfebe commented Apr 30, 2024

/backport to stable29

@nfebe
Copy link
Contributor Author

nfebe commented Apr 30, 2024

/backport to stable28

@nfebe
Copy link
Contributor Author

nfebe commented Apr 30, 2024

/backport to stable27

@@ -487,25 +417,6 @@ protected function validateExpirationDateLink(IShare $share) {
}
}

// If expiredate is empty set a default one if there is a default
Copy link
Member

Choose a reason for hiding this comment

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

but you are removing the default functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes :)... Since the users now have the opportunity to modify this settings before a share is created. i.e the user can see on the share creation menu, that an expiry date is required and can either allow the default or remove if not enforced.

Leaving this default functionality means, we always force shares to have expiry dates even when that's not the users intention.

Copy link
Member

Choose a reason for hiding this comment

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

The problem is that currently existing clients and app might rely on the default and not populate it via the UI or send it with each request.
So this is a breaking change that is impossible to discover and will lead to a lot of shares not expiring although they should.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. This breaking change is inevitable if we would solve #44219 though.

I am not sure but perhaps I could introduce checks for clients/app calls.

Another though is that Manager class is only part of the private API and maybe all we need to do is make sure the apps we maintain that uses the non public share interface are updated?

Copy link
Member

Choose a reason for hiding this comment

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

Another though is that Manager class is only part of the private API and maybe all we need to do is make sure the apps we maintain that uses the non public share interface are updated?

I meant apps like Android, iOS and our Desktop Client:

That being said, the update also supports it, but basically you need to set it to '' (empty string) not null when updating a share and removing a expiration date.

Seems to work when updating, just not when creating, as the check is always executed then.
So instead of tampering with validateExpirationDateInternal like this, I would try to get the information into the share object that no expirationDate was sent and in

if ($fullId === null && $expirationDate === null && $defaultExpireDate) {
instead of only checking $expirationDate === null you also check whether it was sent with the empty string, and only set the default date when it was not sent as empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @nickvergessen resorted to something similar, makes plenty of sense.

@nfebe nfebe force-pushed the 44219-share-server-respect-empty-expiry-date branch 2 times, most recently from 9effd09 to e6a6340 Compare April 30, 2024 12:31
@nfebe nfebe requested review from provokateurin and removed request for provokateurin May 23, 2024 12:46
@nfebe nfebe force-pushed the 44219-share-server-respect-empty-expiry-date branch from 30e59ba to a47d7b0 Compare May 23, 2024 12:49
@nfebe nfebe force-pushed the 44219-share-server-respect-empty-expiry-date branch 2 times, most recently from 2a233b1 to 8dd6554 Compare May 23, 2024 13:08
nfebe added 3 commits May 23, 2024 14:11
If `expireDate` is an empty string and not `null` then the server should not set a default.

Signed-off-by: fenn-cs <[email protected]>
- Verify that explicitly sending empty `expireDate` param to server overwrite default
and sets not expiry date, if non is enforced.

- Update tests to avoid converting empty string to date.

Signed-off-by: fenn-cs <[email protected]>
@nfebe nfebe force-pushed the 44219-share-server-respect-empty-expiry-date branch from 8dd6554 to d41d885 Compare May 23, 2024 13:11
@ShGKme
Copy link
Contributor

ShGKme commented May 28, 2024

This breaks uploading in Talk which expects $expireDate to be string

@blizzz
Copy link
Member

blizzz commented May 28, 2024

This breaks uploading in Talk which expects $expireDate to be string

Also on 27?

@Antreesy
Copy link
Contributor

Also on 27?

Confirm for stable27
image

@nickvergessen nickvergessen added the pending documentation This pull request needs an associated documentation update label Jul 18, 2024
@nfebe nfebe removed the pending documentation This pull request needs an associated documentation update label Jul 21, 2024
@blizzz blizzz mentioned this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

[Bug]: When creating email share expiry date is set by default without enforcement
9 participants