diff --git a/src/borg/helpers/parseformat.py b/src/borg/helpers/parseformat.py index 193023df5..afb1b0cab 100644 --- a/src/borg/helpers/parseformat.py +++ b/src/borg/helpers/parseformat.py @@ -18,6 +18,7 @@ from functools import partial from string import Formatter from ..logger import create_logger +from ..platformflags import is_win32 logger = create_logger() @@ -453,8 +454,8 @@ class Location: (?P.+) """ - # abs_path must start with a slash. - abs_path_re = r"(?P/.+)" + # abs_path must start with a slash (or drive letter on Windows). + abs_path_re = r"(?P[A-Za-z]:/.+)" if is_win32 else r"(?P/.+)" # path may or may not start with a slash. abs_or_rel_path_re = r"(?P.+)" @@ -493,7 +494,8 @@ class Location: rclone_re = re.compile(r"(?Prclone):(?P(.*))", re.VERBOSE) - file_or_socket_re = re.compile(r"(?P(file|socket))://" + abs_path_re, re.VERBOSE) + sl = "/" if is_win32 else "" + file_or_socket_re = re.compile(r"(?P(file|socket))://" + sl + abs_path_re, re.VERBOSE) local_re = re.compile(local_path_re, re.VERBOSE)