ConnorYoh
43887c8179
Fix/V2/unzip_images ( #4647 )
...
Method Usage by Context
| Context | Method Used | Respects Preferences | HTML Detection |
|------------------------------|-------------------------------------------------------|------------------------|----------------|
| Tools (via useToolResources) | extractZipFiles() →
extractWithPreferences() | ✅ Yes | ✅ Yes |
| Automation | extractAutomationZipFiles() → extractAllFiles() | ❌ No
(always extracts) | ✅ Yes |
| Manual Unzip | extractAndStoreFilesWithHistory() → extractAllFiles() |
❌ No (always extracts) | ✅ Yes |
| Auto-Upload | extractAllFiles() directly | ❌ No (always extracts) | ✅
Yes |
Detailed Behavior Matrix
| Context | HTML Files | Auto-Unzip OFF | Within Limit | Exceeds Limit |
Notes |
|--------------------------|-------------|----------------|--------------|---------------|----------------------------------------|
| Tools (useToolResources) | Keep zipped | Keep zipped | Extract all |
Keep zipped | Respects user preferences |
| Automation | Keep zipped | Extract all | Extract all | Extract all |
Ignores preferences (automation needs) |
| Manual Unzip | Keep zipped | Extract all | Extract all | Extract all |
User explicitly unzipping |
| Auto-Upload | Keep zipped | Extract all | Extract all | Extract all |
User dropped files |
Simplified Decision Flow
ZIP File Received
│
├─ Contains HTML? → Keep as ZIP (all contexts)
│
└─ No HTML
│
├─ Tools Context
│ ├─ Auto-unzip OFF? → Keep as ZIP
│ └─ Auto-unzip ON
│ ├─ File count ≤ limit? → Extract all
│ └─ File count > limit? → Keep as ZIP
│
└─ Automation/Manual/Auto-Upload
└─ Extract all (ignore preferences)
Key Changes from Previous Version
| Entry Point | Code Path | skipAutoUnzip | Respects Preferences? | HTML
Detection? | Extraction Behavior |
|-----------------------------------------------|----------------------------------------------------------------------------------------|---------------|-----------------------|---------------------------|-------------------------------------------------------------------------|
| Direct File Upload (FileEditor, LandingPage) |
FileContext.addRawFiles() → fileActions.addFiles() | True | ❌ No | ✅ Yes
| Always extract (except HTML ZIPs) |
| Tool Outputs (Split, Merge, etc.) | useToolResources.extractZipFiles()
→ zipFileService.extractWithPreferences() | false | ✅ Yes | ✅ Yes |
Conditional: Only if autoUnzip=true AND file count ≤ autoUnzipFileLimit
|
| Load from Storage (FileManager) | fileActions.addStirlingFileStubs() |
N/A | N/A | N/A | No extraction - files already processed |
| Automation Outputs |
AutomationFileProcessor.extractAutomationZipFiles() →
zipFileService.extractAllFiles() | N/A | ❌ No | ✅ Yes | Always extract
(except HTML ZIPs) |
| Manual Unzip Action (FileEditor context menu) |
zipFileService.extractAndStoreFilesWithHistory() → extractAllFiles() |
N/A | ❌ No | ✅ Yes (blocks extraction) | Always extract (except HTML
ZIPs) - explicit user action |
---------
Co-authored-by: Connor Yoh <connor@stirlingpdf.com>
2025-10-15 14:17:44 +00:00