Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgwebdir_mod.py @ 9184:f6eb03027411
Fix issue1679: path reconstruction in hgwebdir was mangling things badly
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 22 Jul 2009 15:26:27 -0700 |
parents | 580a79dde2a3 |
children | 8635b33eaade |
comparison
equal
deleted
inserted
replaced
9183:d0225fa2f6c4 | 9184:f6eb03027411 |
---|---|
4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> | 4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
5 # | 5 # |
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2, incorporated herein by reference. | 7 # GNU General Public License version 2, incorporated herein by reference. |
8 | 8 |
9 import os, time | 9 import os, re, time |
10 from mercurial.i18n import _ | 10 from mercurial.i18n import _ |
11 from mercurial import ui, hg, util, templater | 11 from mercurial import ui, hg, util, templater |
12 from mercurial import error, encoding | 12 from mercurial import error, encoding |
13 from common import ErrorResponse, get_mtime, staticfile, paritygen,\ | 13 from common import ErrorResponse, get_mtime, staticfile, paritygen,\ |
14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR | 14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
223 parts = [name] | 223 parts = [name] |
224 if 'PATH_INFO' in req.env: | 224 if 'PATH_INFO' in req.env: |
225 parts.insert(0, req.env['PATH_INFO'].rstrip('/')) | 225 parts.insert(0, req.env['PATH_INFO'].rstrip('/')) |
226 if req.env['SCRIPT_NAME']: | 226 if req.env['SCRIPT_NAME']: |
227 parts.insert(0, req.env['SCRIPT_NAME']) | 227 parts.insert(0, req.env['SCRIPT_NAME']) |
228 url = ('/'.join(parts).replace("//", "/")) + '/' | 228 m = re.match('((?:https?://)?)(.*)', '/'.join(parts)) |
229 # squish repeated slashes out of the path component | |
230 url = m.group(1) + re.sub('/+', '/', m.group(2)) + '/' | |
229 | 231 |
230 # update time with local timezone | 232 # update time with local timezone |
231 try: | 233 try: |
232 d = (get_mtime(path), util.makedate()[1]) | 234 d = (get_mtime(path), util.makedate()[1]) |
233 except OSError: | 235 except OSError: |