##// END OF EJS Templates
hgweb: fix handling of path for old style template...
Benoit Boissinot -
r3595:fc34fd58 default
parent child Browse files
Show More
@@ -441,13 +441,13 b' class hgweb(object):'
441 441
442 442 files = {}
443 443
444 p = path[1:]
445 if p and p[-1] != "/":
446 p += "/"
447 l = len(p)
444 if path and path[-1] != "/":
445 path += "/"
446 l = len(path)
447 abspath = "/" + path
448 448
449 449 for f,n in mf.items():
450 if f[:l] != p:
450 if f[:l] != path:
451 451 continue
452 452 remain = f[l:]
453 453 if "/" in remain:
@@ -483,15 +483,15 b' class hgweb(object):'
483 483 continue
484 484
485 485 yield {"parity": self.stripes(parity),
486 "path": os.path.join(path, f),
486 "path": os.path.join(abspath, f),
487 487 "basename": f[:-1]}
488 488 parity += 1
489 489
490 490 yield self.t("manifest",
491 491 rev=ctx.rev(),
492 492 node=hex(node),
493 path=path,
494 up=_up(path),
493 path=abspath,
494 up=_up(abspath),
495 495 fentries=filelist,
496 496 dentries=dirlist,
497 497 archives=self.archivelist(hex(node)))
@@ -639,6 +639,7 b' class hgweb(object):'
639 639 # find tag, changeset, file
640 640
641 641 def cleanpath(self, path):
642 path = path.lstrip('/')
642 643 return util.canonpath(self.repo.root, '', path)
643 644
644 645 def run(self):
@@ -865,16 +866,15 b' class hgweb(object):'
865 866 self.do_changeset(req)
866 867
867 868 def do_file(self, req):
868 path = req.form.get('file', [''])[0]
869 path = self.cleanpath(req.form.get('file', [''])[0])
869 870 if path:
870 871 try:
871 872 req.write(self.filerevision(self.filectx(req)))
872 873 return
873 874 except hg.RepoError:
874 875 pass
875 path = self.cleanpath(path)
876 876
877 req.write(self.manifest(self.changectx(req), '/' + path))
877 req.write(self.manifest(self.changectx(req), path))
878 878
879 879 def do_diff(self, req):
880 880 self.do_filediff(req)
General Comments 0
You need to be logged in to leave comments. Login now