Преглед изворни кода

fix: fallback from guessing the owner from path in versioning

Signed-off-by: Robin Appelman <robin@icewind.nl>
Robin Appelman пре 3 месеци
родитељ
комит
1125cf7afc
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      apps/files_versions/lib/Listener/FileEventsListener.php

+ 10 - 0
apps/files_versions/lib/Listener/FileEventsListener.php

@@ -367,6 +367,16 @@ class FileEventsListener implements IEventListener {
 		}
 
 		$owner = $node->getOwner()?->getUid();
+
+		// If no owner, extract it from the path.
+		// e.g. /user/files/foobar.txt
+		if (!$owner) {
+			$parts = explode('/', $node->getPath(), 4);
+			if (count($parts) === 4) {
+				$owner = $parts[1];
+			}
+		}
+
 		if ($owner) {
 			$path = $this->rootFolder
 				->getUserFolder($owner)