Skip to content

Commit

Permalink
Fixes nigma#7
Browse files Browse the repository at this point in the history
Added support for protocol relative, http and https URLs.
  • Loading branch information
maestrofjp committed Aug 1, 2014
1 parent 360f75c commit 4d22476
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 @@ -31,7 +31,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 = os.path.join(settings.STATIC_ROOT, 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 4d22476

Please sign in to comment.