Show More
@@ -647,38 +647,31 b' class hgweb(object):' | |||||
647 | def firstitem(query): |
|
647 | def firstitem(query): | |
648 | return query.split('&', 1)[0].split(';', 1)[0] |
|
648 | return query.split('&', 1)[0].split(';', 1)[0] | |
649 |
|
649 | |||
650 | root = req.env.get('REQUEST_URI', '').split('?', 1)[0] |
|
650 | def normurl(url): | |
651 | pi = req.env.get('PATH_INFO', '') |
|
651 | inner = '/'.join([x for x in url.split('/') if x]) | |
652 | if pi: |
|
652 | tl = len(url) > 1 and url.endswith('/') and '/' or '' | |
653 | root = root[:-len(pi)] |
|
|||
654 |
|
||||
655 | if req.env.has_key('REPO_NAME'): |
|
|||
656 | base = '/' + req.env['REPO_NAME'] |
|
|||
657 | else: |
|
|||
658 | base = root |
|
|||
659 |
|
653 | |||
|
654 | return '%s%s%s' % (url.startswith('/') and '/' or '', | |||
|
655 | inner, tl) | |||
|
656 | ||||
|
657 | root = normurl(req.env.get('REQUEST_URI', '').split('?', 1)[0]) | |||
|
658 | pi = normurl(req.env.get('PATH_INFO', '')) | |||
660 | if pi: |
|
659 | if pi: | |
661 |
|
|
660 | # strip leading / | |
662 |
|
|
661 | pi = pi[1:] | |
663 |
if pi |
|
662 | if pi: | |
664 |
|
|
663 | root = root[:-len(pi)] | |
665 | base += '/' |
|
664 | if req.env.has_key('REPO_NAME'): | |
666 | query = pi[len(base):] |
|
665 | rn = req.env['REPO_NAME'] + '/' | |
667 |
|
|
666 | root += rn | |
668 |
|
|
667 | query = pi[len(rn):] | |
669 | # We are using hgwebdir |
|
|||
670 | base += '/' |
|
|||
671 | else: |
|
|||
672 | base += '?' |
|
|||
673 | query = firstitem(req.env['QUERY_STRING']) |
|
|||
674 | else: |
|
668 | else: | |
675 |
|
|
669 | query = pi | |
676 | query = pi[1:] |
|
|||
677 | else: |
|
670 | else: | |
678 |
|
|
671 | root += '?' | |
679 | query = firstitem(req.env['QUERY_STRING']) |
|
672 | query = firstitem(req.env['QUERY_STRING']) | |
680 |
|
673 | |||
681 |
return (root |
|
674 | return (root, query) | |
682 |
|
675 | |||
683 | req.url, query = spliturl(req) |
|
676 | req.url, query = spliturl(req) | |
684 |
|
677 |
General Comments 0
You need to be logged in to leave comments.
Login now