File tree Expand file tree Collapse file tree
apps/dav/lib/Connector/Sabre Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,28 +140,27 @@ public function put($data) {
140140 list ($ partStorage ) = $ this ->fileView ->resolvePath ($ this ->path );
141141 $ needsPartFile = $ partStorage ->needsPartFile () && (strlen ($ this ->path ) > 1 );
142142
143+ $ view = \OC \Files \Filesystem::getView ();
144+
143145 if ($ needsPartFile ) {
144146 // mark file as partial while uploading (ignored by the scanner)
145147 $ partFilePath = $ this ->getPartFileBasePath ($ this ->path ) . '.ocTransferId ' . rand () . '.part ' ;
146148 } else {
147149 // upload file directly as the final path
148150 $ partFilePath = $ this ->path ;
149151
150- $ this ->emitPreHooks ($ exists );
152+ if ($ view && !$ this ->emitPreHooks ($ exists )) {
153+ throw new Exception ('Could not write to final file, canceled by hook ' );
154+ }
151155 }
152156
153- $ view = \OC \Files \Filesystem::getView ();
154-
155157 // the part file and target file might be on a different storage in case of a single file storage (e.g. single file share)
156158 /** @var \OC\Files\Storage\Storage $partStorage */
157159 list ($ partStorage , $ internalPartPath ) = $ this ->fileView ->resolvePath ($ partFilePath );
158160 /** @var \OC\Files\Storage\Storage $storage */
159161 list ($ storage , $ internalPath ) = $ this ->fileView ->resolvePath ($ this ->path );
160162 try {
161163 if (!$ needsPartFile ) {
162- if ($ view && !$ this ->emitPreHooks ($ exists )) {
163- throw new Exception ('Could not write to final file, canceled by hook ' );
164- }
165164 $ this ->changeLock (ILockingProvider::LOCK_EXCLUSIVE );
166165 }
167166
You can’t perform that action at this time.
0 commit comments