File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828use OCA \DAV \Connector \Sabre \Directory ;
2929use OCA \DAV \Connector \Sabre \Exception \Forbidden ;
3030use Sabre \DAV \Exception \BadRequest ;
31+ use Sabre \DAV \Exception \MethodNotAllowed ;
3132use Sabre \DAV \Exception \NotFound ;
3233use Sabre \DAV \INode ;
3334use Sabre \DAV \Server ;
3435use Sabre \DAV \ServerPlugin ;
36+ use Sabre \HTTP \RequestInterface ;
3537
3638class ChunkingPlugin extends ServerPlugin {
3739
@@ -45,9 +47,22 @@ class ChunkingPlugin extends ServerPlugin {
4547 */
4648 public function initialize (Server $ server ) {
4749 $ server ->on ('beforeMove ' , [$ this , 'beforeMove ' ]);
50+ $ server ->on ('beforeMethod:GET ' , [$ this , 'beforeGet ' ]);
4851 $ this ->server = $ server ;
4952 }
5053
54+ /**
55+ * @param RequestInterface $request
56+ */
57+ public function beforeGet ($ request ) {
58+ $ sourceNode = $ this ->server ->tree ->getNodeForPath ($ request ->getPath ());
59+ if (($ sourceNode instanceof FutureFile) || ($ sourceNode instanceof UploadFile)) {
60+ throw new MethodNotAllowed ('Reading intermediate uploads is not allowed ' );
61+ }
62+
63+ return true ;
64+ }
65+
5166 /**
5267 * @param string $sourcePath source path
5368 * @param string $destination destination path
You can’t perform that action at this time.
0 commit comments