Skip to content

Commit

Permalink
Fix version suffix in patched_url
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 19, 2024
1 parent 7e1eb9b commit 1ae6bc7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions panel/io/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,16 @@ def component_resource_path(component, attr, path):
def patch_stylesheet(stylesheet, dist_url):
url = stylesheet.url
if url.startswith(CDN_DIST+dist_url) and dist_url != CDN_DIST:
patched_url = url.replace(CDN_DIST+dist_url, dist_url) + f'?v={JS_VERSION}'
patched_url = url.replace(CDN_DIST+dist_url, dist_url)
elif url.startswith(CDN_DIST) and dist_url != CDN_DIST:
patched_url = url.replace(CDN_DIST, dist_url) + f'?v={JS_VERSION}'
patched_url = url.replace(CDN_DIST, dist_url)
elif url.startswith(LOCAL_DIST) and dist_url.lstrip('./').startswith(LOCAL_DIST):
patched_url = url.replace(LOCAL_DIST, dist_url) + f'?v={JS_VERSION}'
patched_url = url.replace(LOCAL_DIST, dist_url)
else:
return
version_suffix = f'?v={JS_VERSION}'
if not patched_url.endswith(version_suffix):
patched_url += version_suffix
try:
stylesheet.url = patched_url
except Exception:
Expand Down

0 comments on commit 1ae6bc7

Please sign in to comment.