Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New static URL prefix adds a / to all URLs when env var not in use #81

Open
emab opened this issue Jun 5, 2023 · 1 comment
Open

New static URL prefix adds a / to all URLs when env var not in use #81

emab opened this issue Jun 5, 2023 · 1 comment

Comments

@emab
Copy link
Contributor

emab commented Jun 5, 2023

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

This is causing an issue for me - I don't provide a prefix, but now all my static urls are prepended with /. Can I suggest that we only append a / to the prefix if it doesn't end with / and it has been defined?

E.g.

production_server_url = path
if prefix:=DJANGO_VITE_STATIC_URL_PREFIX:
	if not prefix.endswith("/"):
    	prefix += "/"
	production_server_url = urljoin(prefix, path)
@emab
Copy link
Contributor Author

emab commented Jun 5, 2023

#82

I've added a PR for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant