File tree Expand file tree Collapse file tree
apps/files_external/lib/Lib/Storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -676,15 +676,25 @@ private function getDirectoryMetaData(string $path): ?array {
676676 if ($ cacheEntry instanceof CacheEntry) {
677677 return $ cacheEntry ->getData ();
678678 } else {
679- return [
680- 'name ' => basename ($ path ),
679+ // On a cache miss, prefer the real S3 directory marker metadata before falling back
680+ // to synthetic folder data for prefix-only directories.
681+ $ directoryMarker = $ path === '. ' ? false : $ this ->headObject ($ path . '/ ' );
682+ if ($ directoryMarker !== false ) {
683+ $ data = $ this ->objectToMetaData ($ directoryMarker );
684+ } else {
685+ $ data = [
686+ 'name ' => basename ($ path ),
687+ 'mtime ' => time (),
688+ 'storage_mtime ' => time (),
689+ 'etag ' => uniqid (),
690+ ];
691+ }
692+
693+ return array_replace ($ data , [
681694 'mimetype ' => FileInfo::MIMETYPE_FOLDER ,
682- 'mtime ' => time (),
683- 'storage_mtime ' => time (),
684- 'etag ' => uniqid (),
685695 'permissions ' => Constants::PERMISSION_ALL ,
686696 'size ' => -1 ,
687- ];
697+ ]) ;
688698 }
689699 }
690700
You can’t perform that action at this time.
0 commit comments