Skip to content

Static files URL missing "/" on Azure storage #694

Open
@adam-hrb

Description

@adam-hrb

I just upgraded sql-explorer from 4.2 to 5.3 and I see that the pages like explorer/play/ have broken links to static files (styling, images, js, etc) resulting on completely broken styling.

A combination of Django + Azure Storage + SQL Explorer generates links like
https://myblobname.blob.core.windows.net/static/explorermain.5.3.js instead of https://myblobname.blob.core.windows.net/static/explorer/main.5.3.js

It works properly for me on local file storage, but when I switch to my final Azure environment it's missing the trailing / after 'explorer/'.

I investigated that a bit and in file 'vite.py' on Azure
VITE_OUTPUT_DIR = staticfiles_storage.url("explorer/")
returns https://myblobname.blob.core.windows.net/static/explorer so all the latter concatenations are wrong.

It might be a bug in django-storages but I did not find any bug reports related to that, so maybe it's your code being too optimistic.

The simple workaround could be just to check if the VITE_OUTPUT_DIR provided by storage has the trailing / and if not - appending it back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions