Open dkstsh opened 4 years ago
fix it: function object2hrefvirt(bucket, key) { var enckey = key.split('/').map(function (x) { return encodeURIComponent(x); }).join('/');
if (AWS.config.region === "us-east-1") {
return document.location.protocol + '//' + bucket + '.s3.amazonaws.com/' + enckey;
}
fix this else if (AWS.config.region === "cn-north-1") { return document.location.protocol + '//' + bucket + '.s3.' + AWS.config.region + '.amazonaws.com.cn/' + enckey;
} else {
return document.location.protocol + '//' + bucket + '.s3-' + AWS.config.region + '.amazonaws.com/' + enckey;
}
}
I noticed the same issue with the af-south-1 region. This fix seems to work.
I'll copy the change above, since the formatting is broken. s3-
is changed to s3.
function object2hrefvirt(bucket, key) {
var enckey = key.split('/').map(function(x) { return encodeURIComponent(x); }).join('/');
if (AWS.config.region === "us-east-1") {
return document.location.protocol + '//' + bucket + '.s3.amazonaws.com/' + enckey;
} else {
return document.location.protocol + '//' + bucket + '.s3.' + AWS.config.region + '.amazonaws.com/' + enckey;
}
}
function object2hrefpath(bucket, key) {
var enckey = key.split('/').map(function(x) { return encodeURIComponent(x); }).join('/');
if (AWS.config.region === "us-east-1") {
return document.location.protocol + "//s3.amazonaws.com/" + bucket + "/" + enckey;
} else {
return document.location.protocol + "//s3.' + AWS.config.region + '.amazonaws.com/" + bucket + "/" + enckey;
}
}
I would submit a PR, but I spotted this:
and I don't know enough about AWS URLs to be sure of all the possibilities. s3-eu-central-1
works, but s3-af-south-1
does not.
(The URLs don't seem to be consistent between regions, e.g. https://gbif-open-data-eu-central-1.s3-eu-central-1.amazonaws.com/occurrence/2021-04-13/citation.txt and https://gbif-open-data-eu-central-1.s3.eu-central-1.amazonaws.com/occurrence/2021-04-13/citation.txt both work, with either s3-eu-central-1
or s3.eu-central-1
, but https://gbif-open-data-af-south-1.s3-af-south-1.amazonaws.com/occurrence/2021-04-13/citation.txt doesn't work; https://gbif-open-data-af-south-1.s3.af-south-1.amazonaws.com/occurrence/2021-04-13/citation.txt does).
When click the object in the explorer list, the open window was blank with wrong url format, like "bucketname.s3-cn-north-1.amazonaws.com/object". Maybe cause by AWS china region url format is different with global region. The object correct url format is "bucketname.s3.cn-north-1.amazonaws.com.cn/object".
Please fix it, Thanks.