mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 02:46:29 +03:00
feat: decode dcaccount:// URLs and error out on empty URLs early
The problem was reported at <https://support.delta.chat/t/could-not-find-dns-resolutions-for-imap-993-when-adding-a-relay/4907> iOS typically transforms `:` into `://`, we already handle this in `dclogin` URLs, so handle it for `dcaccount` as well.
This commit is contained in:
@@ -721,7 +721,9 @@ async fn test_decode_account() -> Result<()> {
|
||||
|
||||
for text in [
|
||||
"DCACCOUNT:example.org",
|
||||
"DCACCOUNT://example.org",
|
||||
"dcaccount:example.org",
|
||||
"dcaccount://example.org",
|
||||
"DCACCOUNT:https://example.org/new_email?t=1w_7wDjgjelxeX884x96v3",
|
||||
"dcaccount:https://example.org/new_email?t=1w_7wDjgjelxeX884x96v3",
|
||||
] {
|
||||
@@ -737,6 +739,21 @@ async fn test_decode_account() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Tests that decoding empty `dcaccount://` URL results in an error.
|
||||
/// We should not suggest trying to configure an account in this case.
|
||||
/// Such links may be created by copy-paste error or because of incorrect parsing.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_decode_empty_account() -> Result<()> {
|
||||
let ctx = TestContext::new().await;
|
||||
|
||||
for text in ["DCACCOUNT:", "dcaccount:", "dcaccount://", "dcaccount:///"] {
|
||||
let qr = check_qr(&ctx.ctx, text).await;
|
||||
assert!(qr.is_err(), "Invalid {text:?} is parsed as dcaccount URL");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_decode_tg_socks_proxy() -> Result<()> {
|
||||
let t = TestContext::new().await;
|
||||
|
||||
Reference in New Issue
Block a user