Skip to content

Commit

Permalink
More static routing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed May 3, 2024
1 parent bb77326 commit 4a02aae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 6 additions & 0 deletions viewer/src/components/copy_link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export default function CopyUrl({
let path = origin_path
? window.location.pathname.split(origin_path)[0]
: window.location.pathname;
if (path.includes(import.meta.env.VITE_XREDS_BASE_URL)) {
path = path.replace(import.meta.env.VITE_XREDS_BASE_URL, '');
}
if (path.endsWith('/')) {
path = path.slice(0, -1);
}
Expand Down Expand Up @@ -59,6 +62,9 @@ export default function CopyUrl({
origin_path,
)[0]
: window.location.pathname;
if (path.includes(import.meta.env.VITE_XREDS_BASE_URL)) {
path = path.replace(import.meta.env.VITE_XREDS_BASE_URL, '');
}
if (path.endsWith('/')) {
path = path.slice(0, -1);
}
Expand Down
6 changes: 1 addition & 5 deletions xreds/spastaticfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ class SPAStaticFiles(StaticFiles):

async def get_response(self, path: str, scope):
try:
if (
not path.endswith(".js")
and not path.endswith(".css")
and not path.endswith(".html")
):
if not '.' in path:
raise HTTPException(status_code=404)
return await super().get_response(path, scope)
except HTTPException as ex:
Expand Down

0 comments on commit 4a02aae

Please sign in to comment.