mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Handle filenames which has ":" (#9000)
* Fixes #8773 issue * added test for #8773 issue * skip test for windows
This commit is contained in:
@@ -51,6 +51,8 @@ def ByUrl(mapping):
|
|||||||
# Windows absolute paths should really have scheme == "" (local)
|
# Windows absolute paths should really have scheme == "" (local)
|
||||||
if os.name == "nt" and len(parsed.scheme) == 1 and parsed.netloc == "":
|
if os.name == "nt" and len(parsed.scheme) == 1 and parsed.netloc == "":
|
||||||
return schemas[""](data)
|
return schemas[""](data)
|
||||||
|
if parsed.netloc == "":
|
||||||
|
return schemas[""](data)
|
||||||
if parsed.scheme not in schemas:
|
if parsed.scheme not in schemas:
|
||||||
raise Invalid(f"Unsupported URL type {parsed.scheme}://")
|
raise Invalid(f"Unsupported URL type {parsed.scheme}://")
|
||||||
|
|
||||||
|
|||||||
@@ -342,6 +342,13 @@ def test_double_add_unchanged_dir(tmp_dir, dvc):
|
|||||||
assert ret == 0
|
assert ret == 0
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(os.name == "nt", reason="unsupported on Windows")
|
||||||
|
def test_add_colon_in_filename(tmp_dir, dvc):
|
||||||
|
tmp_dir.gen("fo:o", "foo")
|
||||||
|
ret = main(["add", "fo:o"])
|
||||||
|
assert ret == 0
|
||||||
|
|
||||||
|
|
||||||
def test_should_update_state_entry_for_file_after_add(mocker, dvc, tmp_dir):
|
def test_should_update_state_entry_for_file_after_add(mocker, dvc, tmp_dir):
|
||||||
file_md5_counter = mocker.spy(dvc_data.hashfile.hash, "file_md5")
|
file_md5_counter = mocker.spy(dvc_data.hashfile.hash, "file_md5")
|
||||||
tmp_dir.gen("foo", "foo")
|
tmp_dir.gen("foo", "foo")
|
||||||
|
|||||||
Reference in New Issue
Block a user