-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Static Route doesn't resolve correctly link that start with ./ #1228
Comments
Hi @mdaneri, The translation is done at the HTML level client side. If I remember rightly relative paths in HTML are based on the current "folder" which in this case would be You do have the static content path available in <link rel="icon" type="image/png" href="$($data.SwaggerEditorDist)/favicon-32x32.png" sizes="32x32" /> |
Yes but this is a workaround I have to use to make it works. If I use any other webserver (IIS, Apache or anything else) and my page is http://localhost/rootpage/test/index.html` |
But the correct option is what's occurring no? Your page is at If the page was at |
I created a sample to replicate the issue. # STATIC asset folder route
Add-PodeStaticRoute -Path '/editor' -Source './www' -Defaults @('index.html')
Add-PodeStaticRoute -Path '/editor/swagger-editor-dist' -Source './swagger-editor-dist'
Add-PodeRoute -Method Get -Path '/' -ScriptBlock {
Move-PodeResponseUrl -Url '/editor'
} It should work, but it's not. |
Looks like the issue is not related to the translation but the static routes order. I changed the code and now more or less is working # STATIC asset folder route
Add-PodeStaticRoute -Path '/editor/swagger-editor-dist' -Source './swagger-editor-dist'
Add-PodeStaticRoute -Path '/editor' -Source './www' -Defaults @('index.html')
Add-PodeRoute -Method Get -Path '/' -ScriptBlock {
Move-PodeResponseUrl -Url '/editor'
} What is not working is the This looks like a bug. Can you please confirm it? |
Ah yes, the ordering that hierarchical routes like that are created in does matter. It's been reported before that the |
Hi @mdaneri, I just tested myself and If I do call Other than that, the |
I created 2 samples and removed the
|
Hi @mdaneri, I'm still seeing the same as my previous response. For the For However if I update the index.html CSS/JS to include <link href="./editor/swagger-editor-dist/swagger-editor.css" rel="stylesheet"> This is expected to me, because the CSS/JS relative paths will be looking for Is this the same as what you're seeing, or are you seeing something different - like a 404 page instead of a white page? |
Sorry, I misread your previous comment when you said that "the ordering that hierarchical routes like that are created does matter." Do we have this limitation in the documentation? Do you think is worth spending time to fix it? |
It'd be a difficult one to fix without breaking people's integrations who are already aware that the order matters. Best to fix it in 3.0.0 😉 For now, adding a section into the |
Maybe a check with a warning can be good enough |
I had a thought about this last night; it should be fine to fix for just static content. I've an idea on how to quickly fix it, which I'll commit in a moment. |
Please can you fix the default page issue? |
What is the problem you're actually seeing with |
That commit, for static content only, will sort the paths it's searching on into the correct order. I've tested it using your editor examples, and flipping the two static route definitions around, and all works now for me regardless of order the routes are created in. |
Yes, it is working, and the route order is not relevant now. But still, the page doesn't work unless I use http://localhost:8085/editor/index.html The page should work without the need to specify index.html in the URL. This is the issue with |
The way The only way I can fix this is to add a switch parameter which tells Pode to redirect to |
I've added a |
Describe the Bug
I have this webpage
this page is published using
all static files are under the
swagger-editor-dist
folderProblem
when I open the page I get errors that all links are not valid
I checked the content of $WebEvent and this is the result
"Path" is
/docs/swagger-editor-dist/favicon-16x16.png
instead of/docs/swagger-editor/swagger-editor-dist/favicon-16x16.png
The text was updated successfully, but these errors were encountered: