Merge lavoro/daitarn-46-motore: percorsi con lettera di unità (#46)
This commit is contained in:
@@ -10,6 +10,7 @@ import asyncio
|
|||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -61,6 +62,8 @@ def _resolve_recipe_dir(recipe_dir: str | None) -> Path | None:
|
|||||||
root = Path(os.environ.get("VISION_RECIPES_ROOT", _RECIPES_ROOT_DEFAULT)).resolve()
|
root = Path(os.environ.get("VISION_RECIPES_ROOT", _RECIPES_ROOT_DEFAULT)).resolve()
|
||||||
if (
|
if (
|
||||||
Path(rel).is_absolute()
|
Path(rel).is_absolute()
|
||||||
|
# #46: lettera di unita (C:/x) rifiutata su ogni OS; UNC coperto da startswith("\\")
|
||||||
|
or re.match(r"^[A-Za-z]:", rel)
|
||||||
or rel.startswith(("/", "\\"))
|
or rel.startswith(("/", "\\"))
|
||||||
or ".." in Path(rel.replace("\\", "/")).parts
|
or ".." in Path(rel.replace("\\", "/")).parts
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user