upload
upload copied to clipboard
Issue on BackBlaze B2's S3 compatibility and possible solution
Bug Report
Current Behavior After setting the S3 content correctly to BackBlaze B2 (reference: https://www.backblaze.com/docs/cloud-storage-use-the-aws-sdk-for-php-with-backblaze-b2) (which includes key and endpoint), a 500 error always appears when trying to upload a file.
Steps to Reproduce
- Set up S3’s key, bucket, endpoint...etc. details.
- Attempt to upload a file while publishing an article in the frontend (with permitted MIME settings).
- Receive the following error message.
Expected Behavior Should be able to upload correctly due to compatibility between B2 and S3.
Environment
- Flarum version: 1.8.1
- Extension version: 1.2.3
- Website URL: https://forum.azk.ie
- Webserver: LiteSpeed
- Hosting environment: dedicated server
- PHP version: 8.2.7
- Browser: Chrome 115
Possible solution(s)
The issue can be resolved currently by modifying the code within the src/Adapters/AwsS3.php
file from:
if ($acl = $settings->get('fof-upload.awsS3ACL')) {
$config->set('ACL', $acl);
}
to the following:
$acl = $settings->get('fof-upload.awsS3ACL');
$config->set('ACL', $acl);
This will allow files to be uploaded correctly.
Additional Context Initially, I thought the issue was with the ACL settings. However, even after following the instructions at https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl, I am still unable to successfully upload. Interestingly, if ACL exists within $config, even if it's empty, uploading is permitted. Although this might not be the best solution, it does provide a temporary workaround and perhaps better solutions can be sought.
this is caused by the same problem as #328 . currently there's no way to use a custom s3 endpoint
@luceos this code to put where place? https://github.com/FriendsOfFlarum/upload/wiki/aws-s3
Resolved with #399