-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
set default expiration date if expiration date is enforced and it is new share #35564
Conversation
@karakayasemi Great! |
Codecov Report
@@ Coverage Diff @@
## master #35564 +/- ##
============================================
+ Coverage 65.66% 65.67% +<.01%
- Complexity 18757 18761 +4
============================================
Files 1222 1222
Lines 70873 70880 +7
Branches 1289 1289
============================================
+ Hits 46541 46548 +7
Misses 23954 23954
Partials 378 378
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #35564 +/- ##
============================================
+ Coverage 65.66% 65.67% +<.01%
- Complexity 18757 18762 +5
============================================
Files 1222 1222
Lines 70873 70882 +9
Branches 1289 1289
============================================
+ Hits 46541 46550 +9
Misses 23954 23954
Partials 378 378
Continue to review full report at Codecov.
|
It feels better if this is added in the |
Both |
@karakayasemi Excellent, I'll test it now. |
Tests:
What's the API for "create share without expiration" vs "create share with default expiration"? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test issues, see comment
f050db6
to
04c9d97
Compare
@ckamm thanks for detailed explanation. I moved the code-block which set expiration date inside
They both uses same OCS API and following same code flow, no difference between them. |
lib/private/Share20/Manager.php
Outdated
@@ -331,6 +331,20 @@ protected function validateExpirationDate(\OCP\Share\IShare $share) { | |||
|
|||
// If we enforce the expiration date check that is does not exceed | |||
if ($this->shareApiLinkDefaultExpireDateEnforced()) { | |||
// If expiredate is empty set a default one if there is a default | |||
$fullId = null; | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better if this check is moved to a private function isNewShare
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jvillafanez moved to a new function. Thanks.
04c9d97
to
eb0446f
Compare
Retested this case:
There's still a regression with older clients that expect the server to add the default expiration date even if it's not required. But that's much less severe than not being able to create shares, so I'm fine with including this already. I'm pretty sure one can only get everything right by keeping the old "null means default" behavior intact and making the new "request share without expiration" have different API. |
code looks fine, so if it behaves fine I think it's good to merge |
Thanks for highlighting this - was this change introduced in 10.2.0 or before? |
Description
Automatic expiration date setting behavior changed with #34971. It caused regression on client sides. This PR fixes this regression by keeping #34971's functionality.
If max expiration date is enforced set default expiration date for new share. @ckamm please check the behavior is same as expected or not.
@micbar @pmaier1 we should consider this PR for v10.2.1.
Related Issue
Motivation and Context
Automatic expiration date setting behavior changed with #34971. It caused regression on client sides. This PR fixes this regression by keeping #34971's functionality.
How Has This Been Tested?.
To test issue #35550
To test issue #34960
Types of changes
Checklist:
Open tasks: