change: import the config files the user picks, not their whole directory #101
Loading…
Reference in a new issue
No description provided.
Delete branch "change/multi-file-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The custom-provider import was directory-shaped end to end: a single-file picker captioned "Choose Folder" discarded the chosen file, took its parent directory via
absolutePath(), and the root servicecopytree'd that entire tree — guarded bysanity_check, which aborted when the folder held ten or more files outside an extension whitelist (a recursive count against a top-level import, with.crtmissing from the whitelist). Importing one.ovpnout of~/downloadswas impossible; when import did work, unrelated files rode along into a root-owned directory.Fix
getOpenFileNamesmulti-select, honestly captioned. The selection travels in the credentials dict as a JSON list underconfigfiles;folderpathis gone everywhere.add_folder→add_config_files— copies exactly the selected files, plus the companion files (ca,cert,key,tls-auth, …) each config references relative to its own directory, which must travel with the config since openvpn resolves them against the imported copy's location (tunnel.py starts it with the config's dir as cwd). Absolute, inline, and directory-escaping references are left alone.sanity_check, the whole-treecopytree, and the deadcert_filesassignment are deleted.updatedefaulting to"0"unbreaks the CLI import, which never sent that key.TEMPDIRat startup — an import interrupted bycancel_importor a crash never reachesremove_temp_dir, and a dangling temp dir from exactly that was found on this live install.Verification
New
TestFileSelectionImportin tests/test_update.py: one config out of a messy folder imports (the case that used to abort), companions travel (same dir, subdir, quoted names), absolute/inline refs untouched, missing companion warns but imports,..-escaping ref refused, duplicate basenames keep the first, nothing-importable fails with the 3-field message and no temp leftovers. Full suite: 169 passed.Live teardown exercised while testing:
aqomui-cli --delete-providerremoved the orphaned "ProtonVPN (manual)" dir (stale root-owned auth file included) even though no server referenced it.Closes #74
🤖 Generated with Claude Code