From 9eba7fcf2868607443f267f4c8fe7cbe576c3bdb Mon Sep 17 00:00:00 2001 From: owsla Date: Thu, 13 Nov 2008 00:15:56 +0000 Subject: Escape trailing spaces and periods on systems which require it git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@961 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/rdiff_backup/FilenameMapping.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'rdiff-backup/rdiff_backup/FilenameMapping.py') diff --git a/rdiff-backup/rdiff_backup/FilenameMapping.py b/rdiff-backup/rdiff_backup/FilenameMapping.py index 5fbd9dd..439836e 100644 --- a/rdiff-backup/rdiff_backup/FilenameMapping.py +++ b/rdiff-backup/rdiff_backup/FilenameMapping.py @@ -85,6 +85,19 @@ def quote(path): """ QuotedPath = chars_to_quote_regexp.sub(quote_single, path) + if not Globals.must_escape_dos_devices \ + and not Globals.must_escape_trailing_spaces: + return QuotedPath + + if Globals.must_escape_dos_devices: + assert Globals.must_escape_trailing_spaces + + # Escape a trailing space or period (invalid in names on FAT32 under DOS, + # Windows and modern Linux) + if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'): + QuotedPath = QuotedPath[:-1] + \ + "%s%03d" % (quoting_char, ord(QuotedPath[-1])) + if not Globals.must_escape_dos_devices: return QuotedPath -- cgit v1.2.1