Skip to content

Commit

Permalink
Merge maestrofjp commit: Fixes nigma#7
Browse files Browse the repository at this point in the history
Added support for protocol relative, http and https URLs.

maestrofjp@4d22476
  • Loading branch information
maestrofjp authored and cubicuboctahedron committed Nov 24, 2016
1 parent 1fa5b12 commit 7d2dd82
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion easy_pdf/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def fetch_resources(uri, rel):
:rtype: str
:raises: :exc:`~easy_pdf.exceptions.UnsupportedMediaPathException`
"""
if settings.STATIC_URL and uri.startswith(settings.STATIC_URL):
# For protocol relative, http and https URLs, we need to short circuit to skip
# path checking at the end of function
if uri.startswith('//') or uri.startswith('http://') or uri.startswith('https://'):
return uri
elif settings.STATIC_URL and uri.startswith(settings.STATIC_URL):
path = finders.find(uri.replace(settings.STATIC_URL, ""))
elif settings.MEDIA_URL and uri.startswith(settings.MEDIA_URL):
path = os.path.join(settings.MEDIA_ROOT, uri.replace(settings.MEDIA_URL, ""))
Expand Down

0 comments on commit 7d2dd82

Please sign in to comment.