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

Static files inside subfolders are not accessible (404) #2075

Closed
mikekeda opened this issue Mar 21, 2021 · 1 comment · Fixed by #2076
Closed

Static files inside subfolders are not accessible (404) #2075

mikekeda opened this issue Mar 21, 2021 · 1 comment · Fixed by #2076
Assignees
Labels

Comments

@mikekeda
Copy link

Describe the bug

After upgrading from 20.12.3 to 21.3.0 I'm getting 404 for all my static files (those files are located inside subfolders), example:
GET http://127.0.0.1:8000/static/node_modules/jquery/dist/jquery.min.js 404

but static files that are located directly inside static folder are accessible, example:
GET http://127.0.0.1:8000/static/package.json 200

Code snippet
I added static in this way (it was working fine for Sanic <= 20.12.3):
app.static("/static", "./static")

I'm assuming the problem is in this line:
uri += "/<__file_uri__>"
https://github.com/sanic-org/sanic/blob/master/sanic/mixins/routes.py#L779
looks like there is no place for subfolders

Expected behavior
I expect static files inside subfolders to accessible.

Environment (please complete the following information):

  • OS: MacOS 11.2.3
  • Version 21.3.0
  • Python 3.9.0

Additional context
This is a problem only for local environment, for prod static files are not served by Sanic

@ahopkins
Copy link
Member

😒 I knew there was bound to be some bug with such sweeping changes. I will work on a patch for this and get a 21.3.1 out as soon as I can. We need to add this to test coverage as well.

@ahopkins ahopkins self-assigned this Mar 21, 2021
@ahopkins ahopkins added the bug label Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants