Commit b8e05c46 authored by dgaudet's avatar dgaudet

Escape DOS device filenames when necessary. [Marc Dyksterhouse]


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@779 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent b0bb3dca
......@@ -12,6 +12,8 @@ RPM specfile update from Gordon Rowell.
Add "FilenameMapping.set_init_quote_vals" security exception.
[Marc Dyksterhouse]
Escape DOS device filenames when necessary. [Marc Dyksterhouse]
New in v1.1.7 (2006/11/12)
--------------------------
......
......@@ -83,7 +83,17 @@ def quote(path):
the quoting character.
"""
return chars_to_quote_regexp.sub(quote_single, path)
QuotedPath = chars_to_quote_regexp.sub(quote_single, path)
if not Globals.must_escape_dos_devices:
return QuotedPath
# Escape first char of any special DOS device files even if filename has an
# extension. Special names are: aux, prn, con, nul, com0-9, and lpt1-2.
if not re.search(r"^aux(\..*)*$|^prn(\..*)*$|^con(\..*)*$|^nul(\..*)*$|" \
r"^com[0-9](\..*)*$|^lpt[12]{1}(\..*)*$", QuotedPath, \
re.I):
return QuotedPath
return "%s%03d" % (quoting_char, ord(QuotedPath[0])) + QuotedPath[1:]
def quote_single(match):
"""Return replacement for a single character"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment