This repository has been archived by the owner. It is now read-only.

Chunked uploads in Safari 9 not working #1952

Open
fschwahn opened this Issue Nov 28, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@fschwahn
Copy link

fschwahn commented Nov 28, 2017

Type of issue

  • Bug report
  • Feature request

Uploader type

  • Traditional
  • S3
  • Azure
Bug Report

Fine Uploader version

5.14.5

Browsers where the bug is reproducible

Safari 9.1.2

Operating systems where the bug is reproducible

macOS 10.11

Exact steps required to reproduce the issue

  1. Enable chunking
  2. Upload a file which is large enough to cause chunking
  3. SignatureDoesNotMatch error from S3

All relevant Fine Uploader-related code that you have written

Hard to extract, don't think it is relevant.

Detailed explanation of the problem

Note that this does not happen in other browsers or newer versions of Safari, it is a problem with Safari 9.1 only (maybe earlier versions are affected).

The request to be signed sent to our server from fineuploader looks e.g. like this:

PUT\n\n\n\nx-amz-date:Tue, 28 Nov 2017 08:48:18 GMT\n/bucket-name/development/cache/1511858898513-1-0001-7257/3fa9a757-605e-4d17-84ec-aaf7334676b1?partNumber=3&uploadId=WSIEbflFVyKimWDXz8R46hL4of6E96Xw4NzdW3lehcYVbXiI9uB4PjyyUdEo1mQToN.Jq7Ycpb5KUOvg3r7ZlCJKwKPVRsb3H5Ki9GHBG.hopcomJ7aHme5UUv4Et7GK

Amazon then responds as follows:

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>XXX</AWSAccessKeyId><StringToSign>PUT

,

x-amz-date:Tue, 28 Nov 2017 08:48:24 GMT
/bucket-name/development/cache/1511858898513-1-0001-7257/3fa9a757-605e-4d17-84ec-aaf7334676b1?partNumber=3&amp;uploadId=WSIEbflFVyKimWDXz8R46hL4of6E96Xw4NzdW3lehcYVbXiI9uB4PjyyUdEo1mQToN.Jq7Ycpb5KUOvg3r7ZlCJKwKPVRsb3H5Ki9GHBG.hopcomJ7aHme5UUv4Et7GK</StringToSign><SignatureProvided>Iv9ZA51OMixxJCoUPvh0LdfYtnc=</SignatureProvided><StringToSignBytes>50 55 54 0a 0a 2c 0a 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 54 75 65 2c 20 32 38 20 4e 6f 76 20 32 30 31 37 20 30 38 3a 34 38 3a 32 34 20 47 4d 54 0a 2f 73 68 6f 77 72 6f 6f 6d 2d 73 65 61 70 6f 69 6e 74 2d 64 65 76 65 6c 6f 70 6d 65 6e 74 2f 64 65 76 65 6c 6f 70 6d 65 6e 74 2f 63 61 63 68 65 2f 31 35 31 31 38 35 38 38 39 38 35 31 33 2d 31 2d 30 30 30 31 2d 37 32 35 37 2f 33 66 61 39 61 37 35 37 2d 36 30 35 65 2d 34 64 31 37 2d 38 34 65 63 2d 61 61 66 37 33 33 34 36 37 36 62 31 3f 70 61 72 74 4e 75 6d 62 65 72 3d 33 26 75 70 6c 6f 61 64 49 64 3d 57 53 49 45 62 66 6c 46 56 79 4b 69 6d 57 44 58 7a 38 52 34 36 68 4c 34 6f 66 36 45 39 36 58 77 34 4e 7a 64 57 33 6c 65 68 63 59 56 62 58 69 49 39 75 42 34 50 6a 79 79 55 64 45 6f 31 6d 51 54 6f 4e 2e 4a 71 37 59 63 70 62 35 4b 55 4f 76 67 33 72 37 5a 6c 43 4a 4b 77 4b 50 56 52 73 62 33 48 35 4b 69 39 47 48 42 47 2e 68 6f 70 63 6f 6d 4a 37 61 48 6d 65 35 55 55 76 34 45 74 37 47 4b</StringToSignBytes><RequestId>XXX</RequestId><HostId>UuLdzgTRy7szpVi8QbDa3+yNI8izQ7ycvJ07BaqVQzB7vtX1WRBF88tuinJAVMGe/Pv5n/M1EoM=</HostId></Error>

Note that there is an extra comma in <StringToSign> which is missing from the request to the signature endpoint. I verified that this is the problem by manually inserting the comma in my signature endpoint - after that the chunked uploads work.

@rnicholus

This comment has been minimized.

Copy link
Member

rnicholus commented Nov 28, 2017

Since I don't have access to Safari 9 - I can't verify/fix anything specific to that browser. But I would be quite surprised if this was an issue with Fine Uploader, as yours is the only such report, and failure to upload to S3 in Safari 9 would certainly generate more than 1 report. You'll probably want to dig deeper to determine how your specific environment is causing this.

@fschwahn

This comment has been minimized.

Copy link

fschwahn commented Nov 29, 2017

Ok, I tracked this down, it is a regression which was introduced in 5.14.5 - there was only one change in this release: 5.14.4...5.14.5 - this was a bugfix for edge.

This broke chunked uploads for Safari 9. Safari 9 seems to replace the empty content type with a single comma. Maybe the content type should only be set if it was detected that edge >= 15 is used?

@fschwahn

This comment has been minimized.

Copy link

fschwahn commented Dec 1, 2017

@rnicholus I forgot to mention that I replicated the issue with the exact code from https://fineuploader.com/demos.html#amazon-demo, and the php endpoint from https://github.com/paulmelnikow/fine-uploader-server/blob/master/php/s3/s3demo-thumbnails-cors.php, so I'm sure it is not my environment causing this.

@rnicholus

This comment has been minimized.

Copy link
Member

rnicholus commented Dec 18, 2017

I would strongly welcome a PR to address this. Your suggestion sounds appropriate to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.