LiveUI / S3

S3 Client written in Swift
MIT License
94 stars 60 forks source link

XAmzContentSHA256Mismatch #47

Closed SmartJSONEditor closed 5 years ago

SmartJSONEditor commented 5 years ago

Hello, I am not sure what happend but after some time this library was working fine, I am starting getting issues on linux. This issues do not happen when compiled on macOS local machine, just getting them when running in Ubuntu 18.04

errorResponse(NIOHTTP1.HTTPResponseStatus.badRequest, S3.ErrorMessage(code: "XAmzContentSHA256Mismatch", message: "The provided \'x-amz-content-sha256\' header does not match what was computed.", bucket: nil, endpoint: nil

SmartJSONEditor commented 5 years ago

This issue happens when Vapor receives a file data via post request. This issue do not happen when you load a local file and send it to amazon, only when the data is received via post data.

juanLovera commented 4 years ago

Yes, instead of directly uploading the file received through the multipart, create an intermediate one:

let file = File.Upload(data: Data(imageRequest.file.data.withByteBuffer { $0 }), bucket: defaultBucket, destination: destination, access: .publicRead)

        return try s3.put(file: file, headers: [:], on: req)

El vie., 21 feb. 2020 a las 5:33, Vegi Woo (notifications@github.com) escribió:

Good afternoon, did you somehow solve this problem? Everything works fine for me on the local mac, on a remote server with Ubuntu I get this problem

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LiveUI/S3/issues/47?email_source=notifications&email_token=ABCTJQ2ZILAKBOVHC5IXXMTRD6GUVA5CNFSM4IMNCP5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMR5YAY#issuecomment-589552643, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCTJQ2QNCSPHNVYIEYQZKTRD6GUVANCNFSM4IMNCP5A .