Skip to content

Commit

Permalink
Bugfix urls to EU-S3 buckets.
Browse files Browse the repository at this point in the history
If you try to address EU-buckets with http://s3.amazonaws.com/bucket/
you get:
    The bucket you are attempting to access must be addressed using
    the specified endpoint. Please send all future requests to this
    endpoint.

Thats why we should let underlying infrastructure form the url as it
might know this kind if things. - Anton Lundin
  • Loading branch information
amercader committed Oct 10, 2012
1 parent 5ac274b commit 1b1375a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ckan/controllers/storage.py
Expand Up @@ -262,7 +262,10 @@ def get_metadata(self, label):
if storage_backend in ['google', 's3']:
if not label.startswith("/"):
label = "/" + label
url = "https://%s/%s%s" % (self.ofs.conn.server_name(), bucket, label)
url = "https://%s%s" % (
self.ofs.conn.calling_format.build_host(
self.ofs.conn.server_name(), bucket), label)

else:
url = h.url_for('storage_file',
label=label,
Expand Down

0 comments on commit 1b1375a

Please sign in to comment.