| 1 | # extract_work_dir_archive.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the authenticated, CSRF-protected archive extraction endpoint for File Browser. |
| 6 | - Extract supported archives into a new sibling folder without overwriting existing content. |
| 7 | |
| 8 | ## Ownership |
| 9 | |
| 10 | - `ExtractWorkDirArchive` receives a file `path` and optional listing `currentPath`. |
| 11 | - `extract_archive` validates the source, creates the destination, and removes partial output on failure. |
| 12 | |
| 13 | ## Runtime Contracts |
| 14 | |
| 15 | - ZIP and TAR-family archives use the Python standard library; RAR, 7z, and single-file compression formats use the image `7zip` binary. |
| 16 | - Archive members must remain below the new destination and cannot be links or devices. |
| 17 | - Successful extraction emits `workdir_file_mutation_after` and returns a refreshed file listing plus `extracted_path`. |
| 18 | |
| 19 | ## Verification |
| 20 | |
| 21 | - Run `pytest tests/test_file_browser_archives.py tests/test_file_browser_navigation.py`. |