@@ -319,16 +319,12 @@ public function getLocks($uri) {
319319
320320 try {
321321 $ node = $ this ->getNodeForPath ($ uri );
322-
323322 if ($ node instanceof Sabre_DAV_ILockable) return $ node ->getLocks ();
324- if ($ this ->lockManager ) return $ this ->lockManager ->getLocks ($ uri );
325- return array ();
326-
327323 } catch (Sabre_DAV_FileNotFoundException $ e ){
328- // In case the node didn't exist, there are no locks
329- return array ();
324+ // In case the node didn't exist, this could be a lock-null request
330325 }
331-
326+ if ($ this ->lockManager ) return $ this ->lockManager ->getLocks ($ uri );
327+ return array ();
332328 }
333329
334330 /**
@@ -343,9 +339,13 @@ public function getLocks($uri) {
343339 */
344340 public function lockNode ($ uri ,Sabre_DAV_Lock $ lockInfo ) {
345341
346- $ node = $ this ->getNodeForPath ($ uri );
342+ try {
343+ $ node = $ this ->getNodeForPath ($ uri );
344+ if ($ node instanceof Sabre_DAV_ILockable) return $ node ->lock ($ lockInfo );
345+ } catch (Sabre_DAV_FileNotFoundException $ e ) {
346+ // In case the node didn't exist, this could be a lock-null request
347+ }
347348
348- if ($ node instanceof Sabre_DAV_ILockable) return $ node ->lock ($ lockInfo );
349349 if ($ this ->lockManager ) return $ this ->lockManager ->lock ($ uri ,$ lockInfo );
350350
351351 }
@@ -361,8 +361,13 @@ public function lockNode($uri,Sabre_DAV_Lock $lockInfo) {
361361 */
362362 public function unlockNode ($ uri ,Sabre_DAV_Lock $ lockInfo ) {
363363
364- $ node = $ this ->getNodeForPath ($ uri );
365- if ($ node instanceof Sabre_DAV_ILockable) return $ node ->unlock ($ lockInfo );
364+ try {
365+ $ node = $ this ->getNodeForPath ($ uri );
366+ if ($ node instanceof Sabre_DAV_ILockable) return $ node ->unlock ($ lockInfo );
367+ } catch (Sabre_DAV_FileNotFoundException $ e ) {
368+ // In case the node didn't exist, this could be a lock-null request
369+ }
370+
366371 if ($ this ->lockManager ) return $ this ->lockManager ->unlock ($ uri ,$ lockInfo );
367372
368373 }
0 commit comments