Skip to content

Commit

Permalink
Only append "/" when prefix is provided (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
emab authored Jun 8, 2023
1 parent 740a8d4 commit a26b07e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions django_vite/templatetags/django_vite.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,11 @@ def _generate_production_server_url(path: str) -> str:
str -- Full URL to the asset.
"""

prefix = DJANGO_VITE_STATIC_URL_PREFIX
if not DJANGO_VITE_STATIC_URL_PREFIX.endswith("/"):
prefix += "/"
production_server_url = urljoin(prefix, path)
production_server_url = path
if prefix := DJANGO_VITE_STATIC_URL_PREFIX:
if not DJANGO_VITE_STATIC_URL_PREFIX.endswith("/"):
prefix += "/"
production_server_url = urljoin(prefix, path)

if apps.is_installed("django.contrib.staticfiles"):
from django.contrib.staticfiles.storage import staticfiles_storage
Expand Down

0 comments on commit a26b07e

Please sign in to comment.