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