diced / zipline

A ShareX/file upload server that is easy to use, packed with features, and with an easy setup!
https://zipline.diced.sh/
MIT License
1.31k stars 128 forks source link

Bug: Invalid Bucket Name using Backblaze's S3 Compatible API #573

Closed adrianthehusky closed 1 month ago

adrianthehusky commented 1 month ago

What happened?

Using Backblaze B2's S3 compatible API, Zipline is reporting the bucket name is invalid even though the name is correct. Loading the access key/id into Cyberduck to test does show the bucket there and accessible under the exact same name I defined in my config.

Bucket type is private, key is restricted to that bucket but does have the "List Buckets" permission, which would list all bucket names on the account.

Version

latest (ghcr.io/diced/zipline or ghcr.io/diced/zipline:latest)

What browser(s) are you seeing the problem on?

Firefox

Zipline Logs

2024-07-14 06:09:45,050 AM debug [upload] recieved upload (len=1) [{"fieldname":"file","originalname":"SMPTE_Color_Bars_16x9.png","mimetype":"image/png","size":150494,"encoding":"7bit"}]

InvalidBucketNameError: Invalid bucket name: ziplineBucketName

    at putObject (/zipline/node_modules/minio/dist/main/minio.js:578:13)

    at <anonymous> (/zipline/node_modules/minio/dist/main/promisify.js:28:10)

    at new Promise (<anonymous>)

    at Client.<anonymous> (/zipline/node_modules/minio/dist/main/promisify.js:17:12)

    at S3.save (/zipline/src/lib/datasources/S3.ts:32:23)

    at S (/zipline/.next/server/pages/api/upload.js:3:14630)

    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

2024-07-14 06:09:45,124 AM info  [server::response] POST /api/upload -> 500

Browser Logs

No response

Additional Info

Config (bucket names and keys removed)

      - DATASOURCE_TYPE=s3
      - DATASOURCE_S3_USE_SSL=true
      - DATASOURCE_S3_ACCESS_KEY_ID=0000
      - DATASOURCE_S3_SECRET_ACCESS_KEY=0000
      - DATASOURCE_S3_ENDPOINT=s3.us-west-001.backblazeb2.com
      - DATASOURCE_S3_PORT=443
      - DATASOURCE_S3_BUCKET=ziplineBucketName
      - DATASOURCE_S3_FORCE_S3_PATH=true
      - DATASOURCE_S3_REGION=us-west-001
adrianthehusky commented 1 month ago

For anyone who finds this in the future, apparently minio will return Invalid bucket name if you use capital letters in your bucket name at all. Switch to all lowercase and it works fine.