upload icon indicating copy to clipboard operation
upload copied to clipboard

Issue on BackBlaze B2's S3 compatibility and possible solution

Open SumiHeart opened this issue 1 year ago • 2 comments

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

  1. Set up S3’s key, bucket, endpoint...etc. details.
  2. Attempt to upload a file while publishing an article in the frontend (with permitted MIME settings).
  3. 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.

SumiHeart avatar Jul 26 '23 05:07 SumiHeart

this is caused by the same problem as #328 . currently there's no way to use a custom s3 endpoint

Javier-Rotelli avatar Aug 02 '23 14:08 Javier-Rotelli

@luceos this code to put where place? https://github.com/FriendsOfFlarum/upload/wiki/aws-s3

hiepvq avatar Nov 27 '23 10:11 hiepvq

Resolved with #399

DavideIadeluca avatar Jun 17 '24 18:06 DavideIadeluca