mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-19 14:02:55 +00:00
Merge pull request #7605 from ThomasWaldmann/fix-_resolve_path
fix borg.remote._resolve_path
This commit is contained in:
commit
85b6126629
1 changed files with 2 additions and 2 deletions
|
@ -20,7 +20,6 @@
|
||||||
from .constants import * # NOQA
|
from .constants import * # NOQA
|
||||||
from .helpers import Error, IntegrityError
|
from .helpers import Error, IntegrityError
|
||||||
from .helpers import bin_to_hex
|
from .helpers import bin_to_hex
|
||||||
from .helpers import get_base_dir
|
|
||||||
from .helpers import get_limited_unpacker
|
from .helpers import get_limited_unpacker
|
||||||
from .helpers import replace_placeholders
|
from .helpers import replace_placeholders
|
||||||
from .helpers import sysinfo
|
from .helpers import sysinfo
|
||||||
|
@ -255,7 +254,8 @@ def _resolve_path(self, path):
|
||||||
if isinstance(path, bytes):
|
if isinstance(path, bytes):
|
||||||
path = os.fsdecode(path)
|
path = os.fsdecode(path)
|
||||||
if path.startswith("/~/"): # /~/x = path x relative to own home dir
|
if path.startswith("/~/"): # /~/x = path x relative to own home dir
|
||||||
path = os.path.join(get_base_dir(), path[3:])
|
home_dir = os.environ.get("HOME") or os.path.expanduser("~%s" % os.environ.get("USER", ""))
|
||||||
|
path = os.path.join(home_dir, path[3:])
|
||||||
elif path.startswith("/./"): # /./x = path x relative to cwd
|
elif path.startswith("/./"): # /./x = path x relative to cwd
|
||||||
path = path[3:]
|
path = path[3:]
|
||||||
return os.path.realpath(path)
|
return os.path.realpath(path)
|
||||||
|
|
Loading…
Reference in a new issue