fix: preserve selected public subfolder when opening terminal#2003
Conversation
Greptile SummaryThis PR fixes a regression where opening a terminal from a subfolder within the Acode-documents public SAF provider always navigated to Key changes:
Issues found:
Confidence Score: 4/5Safe to merge; both findings are edge-case P2s that degrade to the old '/public' behaviour rather than causing crashes or data loss. The primary fix is correct and an unambiguous improvement over the previous hard-coded return. The two issues are edge cases (percent characters in folder names, slash-separated docId format) that fall back to pre-existing '/public' behaviour via try/catch, introducing no regressions. Score is 4 rather than 5 because there is a concrete (if uncommon) path where the subfolder is silently dropped. src/lib/openFolder.js – specifically the convertToProotPath function around lines 55 and 67–68. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["convertToProotPath(url)"] --> B{isAcodeTerminalPublicSafUri?}
B -- No --> C[Strip file:// and map alpineRoot / publicDir]
B -- Yes --> D["Uri.parse(url) → docId"]
D --> E["cleanDocId = decodeURIComponent(docId || '')"]
E --> F{cleanDocId empty?}
F -- Yes --> G[return '/public']
F -- No --> H{startsWith publicDir?}
H -- Yes --> I["replace(publicDir, '/public')"]
H -- No --> J{startsWith '/public'?}
J -- Yes --> K["return cleanDocId as-is"]
J -- No --> L{startsWith 'public:'?}
L -- Yes --> M["Path.join('/public', relativePath)"]
L -- No --> N["strip leading '/', Path.join('/public', ...)"]
D -- throws --> O["console.warn + return '/public'"]
Reviews (1): Last reviewed commit: "fix: preserve selected public subfolder ..." | Re-trigger Greptile |
No description provided.