Fix static location in index when prefix is used#1662
Fix static location in index when prefix is used#1662asvetlov merged 2 commits intoaio-libs:masterfrom
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: