Closed phrakon closed 4 years ago
I use my own implementation for yandex cloud s3 (compatible with amazon) based on yours. But it has no sense. It is about 99% your code except endpoint, region and so on.
No, the original code of DownloadAction
it correct: the $filename
argument should contain any sub-folder for the file already, including the subDirTemplate
.
So download requests for file logo.png
and images/logo.png
will be different.
You should use getFullFileName()
to create an argument for the DownloadAction
URL.
What steps will reproduce the problem?
Try to open file 08c699d1d76c228daf06f93f8e04c185.jpg using DownloadAction.
My fileStorage config is:
What is the expected result?
No error.
What do you get instead?
Client error:
GET https://****.storage.yandexcloud.net/08c699d1d76c228daf06f93f8e04c185.jpg
resulted in a404 Not Found
Additional info
if i put '0/8/c/08c699d1d76c228daf06f93f8e04c185.jpg', then https://github.com/yii2tech/file-storage/blob/5cf882e6341587861933365deedbe7bda06af280/src/DownloadAction.php#L103 tells that file not found, so that filename must be without ^name segments
i think https://github.com/yii2tech/file-storage/blob/5cf882e6341587861933365deedbe7bda06af280/src/amazon/Bucket.php#L514 should be
$streamPath = 's3://' . $this->getUrlName() . '/' . $this->getFullFileName($fileName);
anyway it fixes the error