[s3boto] custom domain hardcodes http or https
When custom_domain==True, 'http' or 'https' is hardcoded. Either a new flag should be added to enable a url like 'custom_domain.com/file' or custom_domain should always use 'custom_domain.com/file' and secure_urls can be deprecated.
s3boto.py:217-218
if self.custom_domain:
return "%s://%s/%s" % ('https' if self.secure_urls else 'http', self.custom_domain, name)
Comments (8)
-
adamnelson
-
Ian Lewis
-
assigned issue to
Ian Lewis
-
assigned issue to
-
Ian Lewis
That might be a valid solution. Certainly in that case secure_urls wouldn't be needed. I'll have to think about it a bit more.
I'd really like to limit the number of new variables. There are already like 4 variables that affect url generation.
As a side note I usually see links without the protocol starting with ''. i.e. 'xyz.cloudfront.com' rather than simply just the domain. Otherwise the browser might get confused and think it's a file relative to the current file. Not sure the best-practice here so I'm someone is more informed than me, please let me know.
-
adamnelson
One problem is src attributes in emails. If you use src="example.com/image.jpg" in an img tag, it will crash many versions of Outlook. Not all urls generated by django-storages end up in web browsers :-/
-
Ian Lewis
Cute.
-
spulec
Any update on this?
-
David Larlet
-
David Larlet
- changed status to duplicate
Duplicate of #107.
- Log in to comment »
Since AWS_CUSTOM_DOMAIN hasn't been released yet, I decided to make a backwards incompatible change such that AWS_CUSTOM_DOMAIN must include the scheme.
If AWS_CUSTOM_DOMAIN used to be 'xyz.cloudfront.com' it should now be 'xyz.cloudfront.com' or 'http://xyz.cloudfront.com'
I'm open to renaming the variable to be more clear or having a second variable if anybody has an opinion.
https://github.com/Yipit/django-storages/commit/515b3affcc9dca75847cb8de63989d2b0bdf103f