Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Fix #3501: in_trash splits backslashes, so a Windows Recycle Bin path is found on Linux too

TheHubUser486093895cfbd4cc4bf
diff --git a/strata_control/discovery.py b/strata_control/discovery.py
index 94b41583d..93ac134ce 100644
--- a/strata_control/discovery.py
+++ b/strata_control/discovery.py
@@ -100,7 +100,7 @@ def in_trash(path: str | os.PathLike) -> bool:
"""#3410: True when ``path`` is inside a Trash / Recycle Bin folder (a Strata folder that was deleted with the file manager
is still a folder there, and was remembered as an install): ~/.local/share/Trash/files/.., /.Trash-1000/.., ~/.Trash/..,
$RECYCLE.BIN\\.."""
- parts = [x.lower() for x in Path(path).parts]
+ parts = [x.lower() for p in Path(path).parts for x in str(p).split("\\")] # a Windows-shaped path read on Linux has no separators for Path
for i, x in enumerate(parts):
if x in (".trash", "$recycle.bin", "recycler", "$recycle.bin.old") or x.startswith(".trash-"):
return True
diff --git a/tests/terminal/test_issues_022.py b/tests/terminal/test_issues_022.py
index b1876bc57..79c4b9b1c 100644
--- a/tests/terminal/test_issues_022.py
+++ b/tests/terminal/test_issues_022.py
@@ -405,5 +405,19 @@ class Issue3488IntegrityRetry(unittest.TestCase):
self.assertEqual(ec._hash_settled(path, "good"), "bad") # still wrong after the retry: refuse
+
+class Issue3501TrashOnPosix(unittest.TestCase):
+ """A Windows Recycle Bin path read on Linux: Path does not split backslashes there."""
+
+ def test_windows_path_on_a_posix_path_class(self):
+ from pathlib import PurePosixPath
+ from unittest import mock
+ from strata_control import discovery
+ with mock.patch.object(discovery, "Path", PurePosixPath):
+ self.assertTrue(discovery.in_trash(r"C:\$Recycle.Bin\S-1-5-21\$R123\Strata"))
+ self.assertTrue(discovery.in_trash("/mnt/d/$RECYCLE.BIN/S-1/Strata"))
+ self.assertFalse(discovery.in_trash(r"C:\Users\a\Strata"))
+
+
if __name__ == "__main__":
unittest.main()