Giter Club home page Giter Club logo

Comments (2)

dkstsh avatar dkstsh commented on July 23, 2024

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;
    }
}

from aws-js-s3-explorer.

MattBlissett avatar MattBlissett commented on July 23, 2024

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:

// The following is also a legal form, but we do not support it, so
// you should use s3-eu-central-1 rather than s3.eu-central-1:
// - bucket3.s3.eu-central-1.amazonaws.com

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).

from aws-js-s3-explorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.