-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
properly lock the target file on dav upload when not using part files #9473
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
Conversation
| throw new FileLocked($e->getMessage(), $e->getCode(), $e); | ||
| } | ||
| throw new FileLocked($e->getMessage(), $e->getCode(), $e); | ||
| } |
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.
No need for two ifs ;)
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.
Why? IMO it makes sense to split it. 🤔
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.
I meant the if at
https://github.com/nextcloud/server/pull/9473/files#diff-be504dc886734275f06114e4306fa215R203
and
https://github.com/nextcloud/server/pull/9473/files#diff-be504dc886734275f06114e4306fa215R217
The try catch need to be split sure ;)
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.
fixed
8b854ee to
891460a
Compare
Codecov Report
@@ Coverage Diff @@
## master #9473 +/- ##
=============================================
- Coverage 51.92% 31.27% -20.66%
+ Complexity 25769 25746 -23
=============================================
Files 1635 1641 +6
Lines 95434 96518 +1084
Branches 1308 1393 +85
=============================================
- Hits 49557 30182 -19375
- Misses 45877 66336 +20459
|
rullzer
left a comment
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.
Makes sense!
|
Unit tests fail. :/ |
| $partStorage->unlink($internalPartPath); | ||
| if ($needsPartFile) { | ||
| if ($view) { | ||
| $this->emitPreHooks($exists); |
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.
You ignore the result here now. So if the prehook returns false you should probably also fail right?
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.
See the unit tests, which fail now due to this.
MorrisJobke
left a comment
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.
See unit tests and @rullzer's comment.
Signed-off-by: Robin Appelman <robin@icewind.nl>
891460a to
f017f43
Compare
|
Fixed the unit test |
|
@icewind1991 Does a backport to 13 makes sense or should we skip it? |
|
backport makes sense imo |
|
@icewind1991 Could you prepare the PR? |
While non-partfile storages don't have the file corruption problem on current read/writes (which is why I left this until now) not locking the target file during write can still lead to an inconsistent filecache state because the scanner is not being blocked.