1 parent 7b182a5 commit f76998eCopy full SHA for f76998e
1 file changed
src/detfuzz/contract.py
@@ -3,7 +3,7 @@
3
import json
4
import shutil
5
from datetime import datetime
6
-from pathlib import Path
+from pathlib import Path, PurePosixPath, PureWindowsPath
7
from typing import Any
8
9
SUITE_REPORT_SCHEMA_VERSION = "1.0"
@@ -227,10 +227,12 @@ def _is_date_time(value: object) -> bool:
227
228
def _is_safe_relative_path(value: str) -> bool:
229
normalized = value.replace("\\", "/")
230
- path = Path(normalized)
+ posix_path = PurePosixPath(normalized)
231
+ windows_path = PureWindowsPath(normalized)
232
return (
233
bool(normalized)
- and not path.is_absolute()
234
- and not path.drive
235
- and ".." not in path.parts
+ and not posix_path.is_absolute()
+ and not windows_path.is_absolute()
236
+ and not windows_path.drive
237
+ and ".." not in posix_path.parts
238
)
0 commit comments