diff options
author | Syed Fasiuddin <syed.fasiuddin@icloud.com> | 2024-10-12 21:50:52 +0530 |
---|---|---|
committer | Tim Culverhouse <tim@timculverhouse.com> | 2024-10-16 19:49:14 -0500 |
commit | d13361b8dbaeba9b900108b26b56bf56fce9be26 (patch) | |
tree | 1b44eb65fa0f42c536cf8ea62fc8f9e95f732fe9 /worker | |
parent | d58065acd41ecce5ac5377a1341560dde87c5fe5 (diff) | |
download | aerc-d13361b8dbaeba9b900108b26b56bf56fce9be26.tar.gz |
mbox: handle invalid URL scheme in command line
Currently if `aerc mbox:..` is used on the command line with an invalid
URL schema such as `aerc mbox:~/mbox`, it tries to open "nothing" and
fails, instead of letting the user know that the URL scheme (command
usage) is wrong.
This commit silently handles such wrong URL schemes.
Fixes: https://todo.sr.ht/~rjarry/aerc/281
Signed-off-by: Syed Fasiuddin <syed.fasiuddin@icloud.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'worker')
-rw-r--r-- | worker/mbox/worker.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go index 72a44368..e8b3fa3e 100644 --- a/worker/mbox/worker.go +++ b/worker/mbox/worker.go @@ -59,6 +59,14 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { reterr = err break } + if u.Host == "" && u.Path == "" { + u, err = url.Parse("mbox://" + u.Opaque) + if err != nil { + reterr = err + break + } + } + var dir string if u.Host == "~" { home, err := os.UserHomeDir() |