-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix static location in index when prefix is used #1662
Conversation
3ade2d0
to
558bca6
Compare
When the prefix is used (e.g. not /), the links generated in the index page are wrong. In this patch the relative path is correctly calculated by the pathlib module and a absolute url is used as link in the index page. The original bug can be demonstrated with following example: --- import pathlib from aiohttp import web app = web.Application() app.router.add_static('/static', pathlib.Path(__file__).parent, show_index=True) web.run_app(app) ---
558bca6
to
518bcbb
Compare
Codecov Report
@@ Coverage Diff @@
## master #1662 +/- ##
==========================================
- Coverage 96.86% 96.86% -0.01%
==========================================
Files 34 34
Lines 7302 7301 -1
Branches 1265 1265
==========================================
- Hits 7073 7072 -1
Misses 137 137
Partials 92 92
Continue to review full report at Codecov.
|
@asvetlov could you review this PR |
Well looks good other than the posix part because it would probably jack with running aiohttp on windows? Like I am not sure how it would interfere with how the |
Mind rebasing this PR, or reopen it? |
could you open PR against https://github.com/aio-libs/aiohttp |
7c97b03
to
37c97b8
Compare
Seems that windows also accepts posix paths to an extent as well. |
Thanks! |
When the prefix is used (e.g. not /), the links generated in the
index page are wrong. In this patch the relative path is correctly
calculated by the pathlib module and a absolute url is used as link
in the index page.
The original bug can be demonstrated with following example: