Fix static location in index when prefix is used#1662
Merged
asvetlov merged 2 commits intoaio-libs:masterfrom May 14, 2017
Merged
Fix static location in index when prefix is used#1662asvetlov merged 2 commits intoaio-libs:masterfrom
asvetlov 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.
|
Member
|
@asvetlov could you review this PR |
Contributor
|
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 |
Contributor
|
Mind rebasing this PR, or reopen it? |
Member
|
could you open PR against https://github.com/aio-libs/aiohttp |
7c97b03 to
37c97b8
Compare
Contributor
|
Seems that windows also accepts posix paths to an extent as well. |
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: