Closed imadi closed 7 years ago
I tried in plain javascript also, but two calls are going to the url out of which first call is getting succeeded and the second one is failing
It's a bit of hassle to do this, because if you make a presigned Amazon-S3 url you need to provide the HTTP method, which is usually just 'GET'. But this request is a HEAD request, so you need to provide a different url for that.
Here's how I solved this issue: https://github.com/icidasset/ongaku-ryoho-v2/blob/master/src/workers/sources.js#L27
@icidasset Thanks for helping out! @imadi HEAD requests are made to figure out the size of the file first, this is to prevent the library from having to download the entire file.
Any time 😄
It seems this can also be fixed by:
jsmediatags.Config.EXPERIMENTAL_avoidHeadRequests()
I tried reading ID3 from s3url (private) and I got this error
{ type: 'xhr', info: 'Unexpected HTTP status 403.', xhr: XMLHttpRequest { onloadstart: null, onprogress: null, onabort: null, onerror: [Function], onload: [Function], ontimeout: [Function], onloadend: null, _listeners: {}, onreadystatechange: null, _anonymous: undefined, readyState: 4, response: '', responseText: '', responseType: '', responseURL: 'https://test.s3.amazonaws.com/AUDIO/content_AUDIO_b3935c52-8270-6ffb-8962-6b223fccf7dd_2017-03-27_en-US.mp3?Expires=1648285340&AWSAccessKeyId=AKIAISHV3ZSMOVZ3E2KQ&Signature=ddadadada%2FP81KZOKFOrXE2%2F%2BW0%3D', status: 403, statusText: 'Forbidden', timeout: 30000, upload: XMLHttpRequestUpload { onloadstart: null, onprogress: null, onabort: null, onerror: null, onload: null, ontimeout: null, onloadend: null, _listeners: {}, _request: [Circular], _contentType: null, _body: },
_method: 'HEAD',
_url:
Url {
protocol: 'https:',
slashes: true,
auth: null,
host: 'test.s3.amazonaws.com',
port: null,
hostname: 'test.s3.amazonaws.com',
hash: null,
search: '?Expires=1648285340&AWSAccessKeyId=AKIAISHV3ZSMOVZ3E2KQ&Signature=ada%2FP81KZOKFOrXE2%2F%2BW0%3D',
query: 'Expires=1648285340&AWSAccessKeyId=AKIAISHV3ZSMOVZ3E2KQ&Signature=ad%2FP81KZOKFOrXE2%2F%2BW0%3D',
pathname: '/AUDIO/content_AUDIO_b3935c52-8270-6ffb-8962-6b223fccf7dd_2017-03-27_en-US.mp3',
path: '/AUDIO/content_AUDIO_b3935c52-8270-6ffb-8962-6b223fccf7dd_2017-03-27_en-US.mp3?Expires=1648285340&AWSAccessKeyId=AKIAISHV3ZSMOVZ3E2KQ&Signature=XJomiVok5%2FP81KZOKFOrXE2%2F%2BW0%3D',
href: 'https://airficsp.s3.amazonaws.com/AUDIO/content_AUDIO_b3935c52-8270-6ffb-8962-6b223fccf7dd_2017-03-27_en-US.mp3?Expires=1648285340&AWSAccessKeyId=jdhkdhadkjad&Signature=XJomiVok5%adad%2F%2BW0%3D' },
_sync: false,
_headers:
{ 'If-Modified-Since': 'Sat, 01 Jan 1970 00:00:00 GMT',
Connection: 'keep-alive',
Host: 'airficsp.s3.amazonaws.com',
'User-Agent': 'Mozilla/5.0 (Darwin x64) node.js/4.6.0 v8/4.5.103.37',
'Content-Length': '0' },
_loweredHeaders: { 'if-modified-since': 'If-Modified-Since' },
_mimeOverride: 'text/plain; charset=x-user-defined',
_request: null,
_response: null,
_responseParts: null,
_responseHeaders:
{ 'x-amz-request-id': 'CD7DE175689A1321',
'x-amz-id-2': 'gmYJnepCe2TQ5lsX11fn2CtQD1ip1YixGmcydmpalUL20AJiGn/6kNon7BN+oQFtBaJmez62Yy0=',
'content-type': 'text/plain; charset=x-user-defined',
'transfer-encoding': 'chunked',
date: 'Mon, 27 Mar 2017 10:50:09 GMT',
server: 'AmazonS3' },
_aborting: null,
_error: null,
_loadedBytes: 0,
_totalBytes: 0,
_lengthComputable: false } }
:( xhr Unexpected HTTP status 403.