Skip to content

Commit c1d776c

Browse files
Roman HaninRoman Hanin
authored andcommitted
B2B-1610: Upgrade to Flysystem 2.0
- review notes fix.
1 parent b3f84c5 commit c1d776c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/code/Magento/RemoteStorage/Driver/Adapter/MetadataProvider.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use League\Flysystem\FilesystemAdapter;
1111
use League\Flysystem\FilesystemException;
1212
use League\Flysystem\UnableToRetrieveMetadata;
13+
use Magento\AwsS3\Driver\AwsS3;
1314
use Magento\RemoteStorage\Driver\Adapter\Cache\CacheInterface;
1415

1516
/**
@@ -47,13 +48,19 @@ public function __construct(
4748
public function getMetadata(string $path): array
4849
{
4950
$metadata = $this->cache->getMetadata($path);
50-
if ($metadata && is_array($metadata) && ($metadata['type'] == 'dir' || $this->isMetadataComplete($metadata))) {
51+
if ($metadata && is_array($metadata)
52+
&& ($metadata['type'] == AwsS3::TYPE_DIR || $this->isMetadataComplete($metadata))
53+
) {
5154
return $metadata;
5255
}
5356
try {
5457
$meta = $this->adapter->lastModified($path);
5558
} catch (\InvalidArgumentException | FilesystemException $e) {
56-
throw UnableToRetrieveMetadata::lastModified($path, $e->getMessage(), $e);
59+
throw new UnableToRetrieveMetadata(
60+
"Unable to retrieve metadata for file at location: {$path}. {$e->getMessage()}",
61+
0,
62+
$e
63+
);
5764
}
5865
$data = [
5966
'path' => $path,

0 commit comments

Comments
 (0)