-
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
Fire prehooks when uploading directly to storage #16292
Conversation
Refer to this link for build results (access rights to CI server needed): |
a7b8819
to
3cae013
Compare
A new inspection was created. |
I've added the unit tests to check if the hooks are firing. Please review @rullzer @DeepDiver1975 @icewind1991 @schiesbn @MorrisJobke |
After this one is merged, a bug will appear related to versions and s2s: #16334 |
👍 looks good |
Refer to this link for build results (access rights to CI server needed): |
needs a second reviewer @rullzer @DeepDiver1975 @icewind1991 @schiesbn @MorrisJobke @nickvergessen |
$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); | ||
$fileExists = $storage->file_exists($internalPath); | ||
} | ||
if (!$run || $renameOkay === false || $fileExists === false) { |
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.
This looks weird... the !$run but the comparison for the others..
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.
This only replicates the old behavior.
In the past we only called $view->rename()
instead of $storage->moveFromStorage()
.
In the case of the view, it would internally trigger the pre and post hooks.
If the pre-hook fails, then it would return false. See https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L621 and the else block.
This would cause $renameOkay
to be false.
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.
actually $run means "all the hooks agreed that the action can be run" or "$run is true when the operation is NOT cancelled by a hook"
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 it was just a tiny style thing..
You write !$run but the but the other comparisons are written in full...
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.
Ah yes... it was out of the habit of not trusting our code to return a solid false
in some cases.
I'll leave it as is for now, unless I need to retouch the code for other issues.
upload via webdav now adds a new version :) Just my tiny style comment... but you could also chose to ignore that :P Looking good 👍 |
👍 |
Fire prehooks when uploading directly to storage
…ehooks Fire prehooks when uploading directly to storage
Manually fire pre-hooks in direct to storage upload case (webdav PUT of small files).
Fix for missing versions on WebDAV PUT: #16130
CC @icewind1991
TODOs: