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.
  • Loading branch information
Anton Lundin authored and amercader committed Oct 10, 2012
1 parent b5332a1 commit e80f58e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ckan/controllers/storage.py
Expand Up @@ -262,8 +262,9 @@ 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 e80f58e

Please sign in to comment.