mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
committed by
Paweł Redzyński
parent
d448eb5fc1
commit
c336507e51
@@ -20,7 +20,8 @@ class ImageConverter:
|
||||
image_data: bytes,
|
||||
) -> "StrPath":
|
||||
img_path = os.path.join(
|
||||
path, f"{revision}_{filename.replace(os.sep, '_')}"
|
||||
path,
|
||||
f"{revision}_{filename}".replace(os.sep, "_").replace("/", "_"),
|
||||
)
|
||||
with open(img_path, "wb") as fd:
|
||||
fd.write(image_data)
|
||||
|
||||
@@ -28,3 +28,19 @@ def test_image_converter_with_out(tmp_dir):
|
||||
}
|
||||
|
||||
assert (tmp_dir / "foo" / "r_image.png").read_bytes() == b"content"
|
||||
|
||||
|
||||
def test_image_converter_with_slash_in_revision(tmp_dir):
|
||||
"""Regression test for #7934"""
|
||||
data = b"content"
|
||||
converter = ImageConverter({"out": tmp_dir / "foo"})
|
||||
|
||||
datapoints, _ = converter.convert(data, "feature/r", "image.png")
|
||||
|
||||
assert datapoints[0] == {
|
||||
REVISION_FIELD: "feature/r",
|
||||
"filename": "image.png",
|
||||
SRC_FIELD: str(tmp_dir / "foo" / "feature_r_image.png"),
|
||||
}
|
||||
|
||||
assert (tmp_dir / "foo" / "feature_r_image.png").read_bytes() == b"content"
|
||||
|
||||
Reference in New Issue
Block a user