FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
175 stars 94 forks source link

Issue on BackBlaze B2's S3 compatibility and possible solution #341

Closed SumiHeart closed 3 weeks ago

SumiHeart commented 11 months ago

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

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.

Javier-Rotelli commented 11 months ago

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

hiepvq commented 7 months ago

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

DavideIadeluca commented 3 weeks ago

Resolved with #399