Show More
@@ -749,7 +749,11 def stylemap(styles, paths=None): | |||||
749 | styles = [styles] |
|
749 | styles = [styles] | |
750 |
|
750 | |||
751 | for style in styles: |
|
751 | for style in styles: | |
752 | if not style: |
|
752 | # only plain name is allowed to honor template paths | |
|
753 | if (not style | |||
|
754 | or style in (os.curdir, os.pardir) | |||
|
755 | or os.sep in style | |||
|
756 | or os.altsep and os.altsep in style): | |||
753 | continue |
|
757 | continue | |
754 | locations = [os.path.join(style, 'map'), 'map-' + style] |
|
758 | locations = [os.path.join(style, 'map'), 'map-' + style] | |
755 | locations.append('map') |
|
759 | locations.append('map') |
@@ -580,6 +580,45 phase changes are refreshed (issue4061) | |||||
580 |
|
580 | |||
581 |
|
581 | |||
582 |
|
582 | |||
|
583 | no style can be loaded from directories other than the specified paths | |||
|
584 | ||||
|
585 | $ mkdir -p x/templates/fallback | |||
|
586 | $ cat <<EOF > x/templates/fallback/map | |||
|
587 | > default = 'shortlog' | |||
|
588 | > shortlog = 'fall back to default\n' | |||
|
589 | > mimetype = 'text/plain' | |||
|
590 | > EOF | |||
|
591 | $ cat <<EOF > x/map | |||
|
592 | > default = 'shortlog' | |||
|
593 | > shortlog = 'access to outside of templates directory\n' | |||
|
594 | > mimetype = 'text/plain' | |||
|
595 | > EOF | |||
|
596 | ||||
|
597 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |||
|
598 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log \ | |||
|
599 | > --config web.style=fallback --config web.templates=x/templates | |||
|
600 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
601 | ||||
|
602 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "?style=`pwd`/x" | |||
|
603 | 200 Script output follows | |||
|
604 | ||||
|
605 | fall back to default | |||
|
606 | ||||
|
607 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '?style=..' | |||
|
608 | 200 Script output follows | |||
|
609 | ||||
|
610 | fall back to default | |||
|
611 | ||||
|
612 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '?style=./..' | |||
|
613 | 200 Script output follows | |||
|
614 | ||||
|
615 | fall back to default | |||
|
616 | ||||
|
617 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '?style=.../.../' | |||
|
618 | 200 Script output follows | |||
|
619 | ||||
|
620 | fall back to default | |||
|
621 | ||||
583 | errors |
|
622 | errors | |
584 |
|
623 | |||
585 | $ cat errors.log |
|
624 | $ cat errors.log |
General Comments 0
You need to be logged in to leave comments.
Login now