##// END OF EJS Templates
opener: forbid paths ending with directory separator (issue2507)...
Jim Hague -
r13197:684a977c default
parent child Browse files
Show More
@@ -487,6 +487,7 b' class path_auditor(object):'
487 '''ensure that a filesystem path contains no banned components.
487 '''ensure that a filesystem path contains no banned components.
488 the following properties of a path are checked:
488 the following properties of a path are checked:
489
489
490 - ends with a directory separator
490 - under top-level .hg
491 - under top-level .hg
491 - starts at the root of a windows drive
492 - starts at the root of a windows drive
492 - contains ".."
493 - contains ".."
@@ -504,6 +505,9 b' class path_auditor(object):'
504 def __call__(self, path):
505 def __call__(self, path):
505 if path in self.audited:
506 if path in self.audited:
506 return
507 return
508 # AIX ignores "/" at end of path, others raise EISDIR.
509 if endswithsep(path):
510 raise Abort(_("path ends in directory separator: %s") % path)
507 normpath = os.path.normcase(path)
511 normpath = os.path.normcase(path)
508 parts = splitpath(normpath)
512 parts = splitpath(normpath)
509 if (os.path.splitdrive(path)[0]
513 if (os.path.splitdrive(path)[0]
@@ -107,7 +107,7 b' plain headers'
107 abort: "foo#bar" cannot be used as the name of a patch
107 abort: "foo#bar" cannot be used as the name of a patch
108 abort: "foo:bar" cannot be used as the name of a patch
108 abort: "foo:bar" cannot be used as the name of a patch
109 % qnew with name containing slash
109 % qnew with name containing slash
110 abort: cannot write patch "foo/": (Is a|No such file or) directory (re)
110 abort: path ends in directory separator: foo/
111 abort: "foo" already exists as a directory
111 abort: "foo" already exists as a directory
112 foo/bar.patch
112 foo/bar.patch
113 popping foo/bar.patch
113 popping foo/bar.patch
@@ -172,7 +172,7 b' hg headers'
172 abort: "foo#bar" cannot be used as the name of a patch
172 abort: "foo#bar" cannot be used as the name of a patch
173 abort: "foo:bar" cannot be used as the name of a patch
173 abort: "foo:bar" cannot be used as the name of a patch
174 % qnew with name containing slash
174 % qnew with name containing slash
175 abort: cannot write patch "foo/": (Is a|No such file or) directory (re)
175 abort: path ends in directory separator: foo/
176 abort: "foo" already exists as a directory
176 abort: "foo" already exists as a directory
177 foo/bar.patch
177 foo/bar.patch
178 popping foo/bar.patch
178 popping foo/bar.patch
General Comments 0
You need to be logged in to leave comments. Login now