Bug 5943 - Wrong default staticurl
Summary: Wrong default staticurl
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: hgweb (show other bugs)
Version: 4.6
Hardware: PC Linux
: wish bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-22 05:05 UTC by Cédric Krier
Modified: 2018-08-07 00:00 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments
Patch: strip trailling slash (541 bytes, patch)
2018-07-22 05:05 UTC, Cédric Krier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cédric Krier 2018-07-22 05:05 UTC
Created attachment 2014 [details]
Patch: strip trailling slash

With the changeset 0031e972ded2, the staticurl is construct with req.apppath + '/static/'. But req.apppath may already end with '/' so the url gets two '//' which makes it point to the root.
I think templater should strip first the trailing '/' in req.apppath before appending '/static/'.
Comment 1 Anton Shestakov 2018-07-23 22:58 UTC
I'm not yet sure how to make apppath to end with a / or if // would break anything, can you provide a test case? .rstrip('/') make sense, but right now we're in code freeze until the next month (when 4.7 is released) and that means only bug fixes for stable are pushed. With a test case this could qualify.

Looking at the attached patch, there's also hgwebdir_mod.py that also has the same code, should it also be changed? In general, patches need to go to mercurial-devel mailing list or our phabricator to be reviewed, https://www.mercurial-scm.org/wiki/ContributingChanges
Comment 2 Yuya Nishihara 2018-07-24 08:41 UTC
No idea whether apppath is supposed to end with "/". indygreg?
Comment 3 Cédric Krier 2018-07-25 04:29 UTC
To get apppath ends with a '/' can be obtained with a web.baseurl that ends also with '/'.

Here is the patch on phabricator: https://phab.mercurial-scm.org/D3977
Comment 4 Cédric Krier 2018-07-25 04:32 UTC
Due to a bug in phabricator extension, here is the new link https://phab.mercurial-scm.org/D3978
Comment 5 HG Bot 2018-07-30 09:45 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/258d90f69076
Cédric Krier <ced@b2ck.com>
hgweb: strip trailing '/' in apppath before appending '/static/' (issue5943)

Differential Revision: https://phab.mercurial-scm.org/D3978

(please test the fix)
Comment 6 Bugzilla 2018-08-07 00:00 UTC
Bug was set to TESTING for 7 days, resolving