@@ -71,6 +71,7 @@ class FilesPlugin extends ServerPlugin {
7171 public const GETETAG_PROPERTYNAME = '{DAV:}getetag ' ;
7272 public const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified ' ;
7373 public const CREATIONDATE_PROPERTYNAME = '{DAV:}creationdate ' ;
74+ public const DISPLAYNAME_PROPERTYNAME = '{DAV:}displayname ' ;
7475 public const OWNER_ID_PROPERTYNAME = '{http://owncloud.org/ns}owner-id ' ;
7576 public const OWNER_DISPLAY_NAME_PROPERTYNAME = '{http://owncloud.org/ns}owner-display-name ' ;
7677 public const CHECKSUMS_PROPERTYNAME = '{http://owncloud.org/ns}checksums ' ;
@@ -379,6 +380,15 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
379380 $ propFind ->handle (self ::CREATION_TIME_PROPERTYNAME , function () use ($ node ) {
380381 return $ node ->getFileInfo ()->getCreationTime ();
381382 });
383+ /**
384+ * Return file/folder name as displayname. The primary reason to
385+ * implement it this way is to avoid costly fallback to
386+ * CustomPropertiesBackend (esp. visible when querying all files
387+ * in a folder).
388+ */
389+ $ propFind ->handle (self ::DISPLAYNAME_PROPERTYNAME , function () use ($ node ) {
390+ return $ node ->getName ();
391+ });
382392 }
383393
384394 if ($ node instanceof \OCA \DAV \Connector \Sabre \File) {
@@ -554,6 +564,13 @@ public function handleUpdateProperties($path, PropPatch $propPatch) {
554564 $ node ->setCreationTime ((int ) $ time );
555565 return true ;
556566 });
567+ /**
568+ * Disable modification of the displayname property for files and
569+ * folders via PROPPATCH. See PROPFIND for more information.
570+ */
571+ $ propPatch ->handle (self ::DISPLAYNAME_PROPERTYNAME , function ($ displayName ) {
572+ return 403 ;
573+ });
557574 }
558575
559576 /**
0 commit comments