Python
fix(permissions): a PowerShell script path with backslashes is found on every platform (OPE-236)
Devika Verma2ffebb563e2b
diff --git a/coworker/review_facts.py b/coworker/review_facts.pyindex 1616d70a..d2ca024d 100644--- a/coworker/review_facts.py+++ b/coworker/review_facts.py@@ -651,7 +651,8 @@ def script_runs(command: str, shell: str = "bash") -> list[tuple[Optional[str],if low in _INLINE_CODE_FLAGS:break # inline code: read above, off the whole command lineif low in _SCRIPT_FILE_FLAGS and i + 1 < len(argv) and program in ("pwsh", "powershell"):- out.append((argv[i + 1], None))+ # PowerShell reads a backslash as a path separator on every platform.+ out.append((argv[i + 1].replace("\\", "/"), None))breakif low == "-m":break # a module, not a file@@ -663,7 +664,7 @@ def script_runs(command: str, shell: str = "bash") -> list[tuple[Optional[str],elif program and (argv[0].startswith(("./", ".\\")) or Path(argv[0]).suffix.lower() in _SCRIPT_SUFFIXES):- out.append((argv[0], None))+ out.append((argv[0].replace("\\", "/") if argv[0].startswith(".\\") else argv[0], None))return out