@@ -64,23 +64,29 @@ public function __construct($storage, ICacheEntry $sourceRootInfo) {
6464 $ this ->sourceRootInfo = $ sourceRootInfo ;
6565 $ this ->numericId = $ sourceRootInfo ->getStorageId ();
6666
67- $ absoluteRoot = $ this ->sourceRootInfo ->getPath ();
68-
69- // the sourceRootInfo path is the absolute path of the folder in the "real" storage
70- // in the case where a folder is shared from a Jail we need to ensure that the share Jail
71- // has it's root set relative to the source Jail
72- $ currentStorage = $ storage ->getSourceStorage ();
73- if ($ currentStorage ->instanceOfStorage (Jail::class)) {
74- /** @var Jail $currentStorage */
75- $ absoluteRoot = $ currentStorage ->getJailedPath ($ absoluteRoot );
76- }
77-
7867 parent ::__construct (
7968 null ,
80- $ absoluteRoot
69+ null
8170 );
8271 }
8372
73+ protected function getRoot () {
74+ if (is_null ($ this ->root )) {
75+ $ absoluteRoot = $ this ->sourceRootInfo ->getPath ();
76+
77+ // the sourceRootInfo path is the absolute path of the folder in the "real" storage
78+ // in the case where a folder is shared from a Jail we need to ensure that the share Jail
79+ // has it's root set relative to the source Jail
80+ $ currentStorage = $ this ->storage ->getSourceStorage ();
81+ if ($ currentStorage ->instanceOfStorage (Jail::class)) {
82+ /** @var Jail $currentStorage */
83+ $ absoluteRoot = $ currentStorage ->getJailedPath ($ absoluteRoot );
84+ }
85+ $ this ->root = $ absoluteRoot ;
86+ }
87+ return $ this ->root ;
88+ }
89+
8490 public function getCache () {
8591 if (is_null ($ this ->cache )) {
8692 $ sourceStorage = $ this ->storage ->getSourceStorage ();
@@ -104,7 +110,7 @@ public function getNumericStorageId() {
104110
105111 public function get ($ file ) {
106112 if ($ this ->rootUnchanged && ($ file === '' || $ file === $ this ->sourceRootInfo ->getId ())) {
107- return $ this ->formatCacheEntry (clone $ this ->sourceRootInfo );
113+ return $ this ->formatCacheEntry (clone $ this ->sourceRootInfo , '' );
108114 }
109115 return parent ::get ($ file );
110116 }
@@ -129,16 +135,20 @@ public function moveFromCache(\OCP\Files\Cache\ICache $sourceCache, $sourcePath,
129135 return parent ::moveFromCache ($ sourceCache , $ sourcePath , $ targetPath );
130136 }
131137
132- protected function formatCacheEntry ($ entry ) {
133- $ path = isset ($ entry ['path ' ]) ? $ entry ['path ' ] : '' ;
134- $ entry = parent ::formatCacheEntry ($ entry );
138+ protected function formatCacheEntry ($ entry , $ path = null ) {
139+ if (is_null ($ path )) {
140+ $ path = isset ($ entry ['path ' ]) ? $ entry ['path ' ] : '' ;
141+ $ entry ['path ' ] = $ this ->getJailedPath ($ path );
142+ } else {
143+ $ entry ['path ' ] = $ path ;
144+ }
135145 $ sharePermissions = $ this ->storage ->getPermissions ($ path );
136146 if (isset ($ entry ['permissions ' ])) {
137147 $ entry ['permissions ' ] &= $ sharePermissions ;
138148 } else {
139149 $ entry ['permissions ' ] = $ sharePermissions ;
140150 }
141- $ entry ['uid_owner ' ] = $ this ->storage ->getOwner ($ path );
151+ $ entry ['uid_owner ' ] = $ this ->storage ->getOwner ('' );
142152 $ entry ['displayname_owner ' ] = $ this ->getOwnerDisplayName ();
143153 if ($ path === '' ) {
144154 $ entry ['is_share_mount_point ' ] = true ;
0 commit comments