]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle storage exceptions when trying to set mtime
authorRobin Appelman <robin@icewind.nl>
Thu, 6 Jun 2019 14:09:27 +0000 (16:09 +0200)
committerRobin Appelman <robin@icewind.nl>
Thu, 6 Jun 2019 14:09:27 +0000 (16:09 +0200)
not all storage backends can handle setting the mtime and they might
not always handle that error correctly.

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/View.php

index fef6153fb9ac0fa8aa2b7a55caecaed38257ed7d..2516b782ee7345fd6774e9d09db27dfdaf845f06 100644 (file)
@@ -566,7 +566,12 @@ class View {
                        $hooks[] = 'create';
                        $hooks[] = 'write';
                }
-               $result = $this->basicOperation('touch', $path, $hooks, $mtime);
+               try {
+                       $result = $this->basicOperation('touch', $path, $hooks, $mtime);
+               } catch (\Exception $e) {
+                       $this->logger->logException($e, ['level' => ILogger::INFO, 'message' => 'Error while setting modified time']);
+                       $result = false;
+               }
                if (!$result) {
                        // If create file fails because of permissions on external storage like SMB folders,
                        // check file exists and return false if not.