@@ -147,6 +147,8 @@ public function listContents(string $path = '', bool $deep = false): iterable
147
147
*/
148
148
protected function normalizeObject (array $ bunny_file_array ): StorageAttributes
149
149
{
150
+ $ bunny_file_array ['Path ' ] = str_replace ($ this ->prefixPath , '' , $ bunny_file_array ['Path ' ]);
151
+
150
152
return match ($ bunny_file_array ['IsDirectory ' ]) {
151
153
true => new DirectoryAttributes (
152
154
Util::normalizePath (
@@ -241,6 +243,8 @@ public function writeStream($path, $contents, Config $config): void
241
243
*/
242
244
public function readStream ($ path )
243
245
{
246
+ $ this ->prependPrefix ($ path );
247
+
244
248
try {
245
249
return $ this ->client ->stream ($ path );
246
250
// @codeCoverageIgnoreStart
@@ -306,8 +310,6 @@ public function setVisibility(string $path, string $visibility): void
306
310
*/
307
311
public function visibility (string $ path ): FileAttributes
308
312
{
309
- $ this ->prependPrefix ($ path );
310
-
311
313
try {
312
314
return new FileAttributes ($ this ->getObject ($ path )->path (), null , $ this ->pullzone_url ? 'public ' : 'private ' );
313
315
} catch (UnableToReadFile |TypeError $ e ) {
@@ -323,8 +325,6 @@ public function visibility(string $path): FileAttributes
323
325
*/
324
326
public function mimeType (string $ path ): FileAttributes
325
327
{
326
- $ this ->prependPrefix ($ path );
327
-
328
328
try {
329
329
$ object = $ this ->getObject ($ path );
330
330
@@ -363,8 +363,6 @@ public function mimeType(string $path): FileAttributes
363
363
*/
364
364
protected function getObject (string $ path = '' ): StorageAttributes
365
365
{
366
- $ this ->prependPrefix ($ path );
367
-
368
366
$ directory = pathinfo ($ path , PATHINFO_DIRNAME );
369
367
$ list = (new DirectoryListing ($ this ->listContents ($ directory )))
370
368
->filter (function (StorageAttributes $ item ) use ($ path ) {
@@ -390,8 +388,6 @@ protected function getObject(string $path = ''): StorageAttributes
390
388
*/
391
389
public function lastModified (string $ path ): FileAttributes
392
390
{
393
- $ this ->prependPrefix ($ path );
394
-
395
391
try {
396
392
return $ this ->getObject ($ path );
397
393
} catch (UnableToReadFile $ e ) {
@@ -407,8 +403,6 @@ public function lastModified(string $path): FileAttributes
407
403
*/
408
404
public function fileSize (string $ path ): FileAttributes
409
405
{
410
- $ this ->prependPrefix ($ path );
411
-
412
406
try {
413
407
return $ this ->getObject ($ path );
414
408
} catch (UnableToReadFile $ e ) {
@@ -468,8 +462,6 @@ public function directoryExists(string $path): bool
468
462
*/
469
463
public function fileExists (string $ path ): bool
470
464
{
471
- $ this ->prependPrefix ($ path );
472
-
473
465
$ list = new DirectoryListing ($ this ->listContents (
474
466
Util::splitPathIntoDirectoryAndFile ($ path )['dir ' ]
475
467
));
0 commit comments