Azure does not support visibility

when uploaded image from tinyeditor then get this error. League  \  Flysystem  \  UnableToRetrieveMetadata PHP 8.2.17 10.48.4 Unable to retrieve the visibility for file at location: 72InjyRyBQA9TGK2eKmkdjreJ57lfixFNJV5Y0RF.jpg. Azure does not support visibility
2 Replies
Lucifer
Lucifer4mo ago
I have the same problem. It is similar to the one discussed in https://discord.com/channels/883083792112300104/1210749603293429810/1210751231874703472 In my case, I use R2 from Cloudflare, so I can't use Acl (the error there is that GetObjectAcl is not being implemented from S3). I am using the Filament/Spatie Markdown editor. I have to say that the problem is the error message and that you don't get the image in Markdown, the image DOES upload correctly to R2. So reading a little bit different discussions by github. https://github.com/thephpleague/flysystem/issues/1759 https://github.com/statamic/cms/pull/9065 https://github.com/thephpleague/flysystem/issues/1791 I've tested and commenting out this piece of code from the trait (Filament\Forms\Components\Concerns\HasFileAttachments), everything would work perfectly.
if ($storage->getVisibility($file) === 'private') {
try {
return $storage->temporaryUrl(
$file,
now()->addMinutes(5),
);
} catch (Throwable $exception) {
// This driver does not support creating temporary URLs.
}
}
if ($storage->getVisibility($file) === 'private') {
try {
return $storage->temporaryUrl(
$file,
now()->addMinutes(5),
);
} catch (Throwable $exception) {
// This driver does not support creating temporary URLs.
}
}
I don't know how this could be handled without touching the original trait, since the problem is that you cannot check visibility in R2 (or in S3 without Acl). Any ideas? Thanks! The laravel errors was
[2024-08-22 01:50:58] local.ERROR: Unable to retrieve the visibility for file at location: yCqb5rfYWnR7pl93Ln2UpAyDBRY1JM9J2X0c5Tw6.jpg. {"userId":1,"exception":"[object] (League\\Flysystem\\UnableToRetrieveMetadata(code: 0): Unable to retrieve the visibility for file at location: yCqb5rfYWnR7pl93Ln2UpAyDBRY1JM9J2X0c5Tw6.jpg. at C:\\laragon\\www\\salvaterol\\vendor\\league\\flysystem\\src\\UnableToRetrieveMetadata.php:49)
[stacktrace]
....
[previous exception] [object] (GuzzleHttp\\Exception\\ServerException(code: 501): Server error: `GET https://salvaterol.2cf00200a068ab42ae4ebd03662bf9b1.r2.cloudflarestorage.com/yCqb5rfYWnR7pl93Ln2UpAyDBRY1JM9J2X0c5Tw6.jpg?acl` resulted in a `501 Not Implemented` response:
<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>NotImplemented</Code><Message>GetObjectAcl not implemented</Message>< (truncated...)
[stacktrace]
[2024-08-22 01:50:58] local.ERROR: Unable to retrieve the visibility for file at location: yCqb5rfYWnR7pl93Ln2UpAyDBRY1JM9J2X0c5Tw6.jpg. {"userId":1,"exception":"[object] (League\\Flysystem\\UnableToRetrieveMetadata(code: 0): Unable to retrieve the visibility for file at location: yCqb5rfYWnR7pl93Ln2UpAyDBRY1JM9J2X0c5Tw6.jpg. at C:\\laragon\\www\\salvaterol\\vendor\\league\\flysystem\\src\\UnableToRetrieveMetadata.php:49)
[stacktrace]
....
[previous exception] [object] (GuzzleHttp\\Exception\\ServerException(code: 501): Server error: `GET https://salvaterol.2cf00200a068ab42ae4ebd03662bf9b1.r2.cloudflarestorage.com/yCqb5rfYWnR7pl93Ln2UpAyDBRY1JM9J2X0c5Tw6.jpg?acl` resulted in a `501 Not Implemented` response:
<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>NotImplemented</Code><Message>GetObjectAcl not implemented</Message>< (truncated...)
[stacktrace]
(I couldn't fit it all in one message 😅 )
awcodes
awcodes4mo ago
Honestly, this is a problem with any rich text editor and file uploads. Ie, you want to upload an image to a third party that requires authorization to upload which means a token in the returned url, but you are storing that url with its token in the html, which means any time it’s read back out the token has already expired.
Want results from more Discord servers?
Add your server