mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 09:59:19 -04:00
correctly construct file: URL on windows
This commit is contained in:
parent
ee3373c5e3
commit
0f0566ea63
4 changed files with 9 additions and 5 deletions
|
|
@ -27,6 +27,7 @@ from .platform import SaveFile, SyncFile, sync_dir, safe_fadvise
|
|||
from .repoobj import RepoObj
|
||||
from .checksums import crc32, StreamingXXH64
|
||||
from .crypto.file_integrity import IntegrityCheckedFile, FileIntegrityError
|
||||
from .repository import _local_abspath_to_file_url
|
||||
|
||||
logger = create_logger(__name__)
|
||||
|
||||
|
|
@ -191,7 +192,7 @@ class LegacyRepository:
|
|||
|
||||
def __init__(self, path, create=False, exclusive=False, lock_wait=None, lock=True, send_log_cb=None):
|
||||
self.path = os.path.abspath(path)
|
||||
self._location = Location("file://%s" % self.path)
|
||||
self._location = Location(_local_abspath_to_file_url(self.path))
|
||||
self.version = None
|
||||
# long-running repository methods which emit log or progress output are responsible for calling
|
||||
# the ._send_log method periodically to get log and progress output transferred to the borg client
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class Repository:
|
|||
if isinstance(path_or_location, Location):
|
||||
location = path_or_location
|
||||
if location.proto == "file":
|
||||
url = _local_abspath_to_file_url(location.path) # frequently users give without file:// prefix
|
||||
url = _local_abspath_to_file_url(location.path)
|
||||
else:
|
||||
url = location.processed # location as given by user, processed placeholders
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from ...constants import * # NOQA
|
|||
from . import cmd, generate_archiver_tests, RK_ENCRYPTION
|
||||
from ...helpers import CommandError
|
||||
from ...platformflags import is_haiku
|
||||
from ...repository import _local_abspath_to_file_url
|
||||
|
||||
pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds="local,remote,binary") # NOQA
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ def test_break_lock(archivers, request):
|
|||
def test_with_lock(tmp_path):
|
||||
repo_path = tmp_path / "repo"
|
||||
env = os.environ.copy()
|
||||
env["BORG_REPO"] = "file://" + str(repo_path)
|
||||
env["BORG_REPO"] = _local_abspath_to_file_url(str(repo_path.absolute()))
|
||||
# test debug output:
|
||||
print("sys.path: %r" % sys.path)
|
||||
print("PYTHONPATH: %s" % env.get("PYTHONPATH", ""))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import pytest
|
|||
|
||||
from borgstore.store import Store
|
||||
|
||||
from ..repository import _local_abspath_to_file_url
|
||||
from ..storelocking import Lock, NotLocked, LockTimeout
|
||||
|
||||
ID1 = "foo", 1, 1
|
||||
|
|
@ -11,8 +12,9 @@ ID2 = "bar", 2, 2
|
|||
|
||||
|
||||
@pytest.fixture()
|
||||
def lockstore(tmpdir):
|
||||
store = Store("file://" + str(tmpdir / "lockstore"), levels={"locks/": [0]})
|
||||
def lockstore(tmp_path):
|
||||
lockstore_path = tmp_path / "lockstore"
|
||||
store = Store(_local_abspath_to_file_url(str(lockstore_path.absolute())), levels={"locks/": [0]})
|
||||
store.create()
|
||||
with store:
|
||||
yield store
|
||||
|
|
|
|||
Loading…
Reference in a new issue