mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Fix panic with invalid sync server URL with port (#2412)
This commit is contained in:
parent
097fecbded
commit
e5d5d1d4bd
2 changed files with 6 additions and 0 deletions
|
@ -112,6 +112,7 @@ Fabricio Duarte <fabricio.duarte.jr@gmail.com>
|
||||||
Mani <github.com/krmanik>
|
Mani <github.com/krmanik>
|
||||||
Kaben Nanlohy <kaben.nanlohy@gmail.com>
|
Kaben Nanlohy <kaben.nanlohy@gmail.com>
|
||||||
Tobias Predel <tobias.predel@gmail.com>
|
Tobias Predel <tobias.predel@gmail.com>
|
||||||
|
Daniel Tang <danielzgtg.opensource@gmail.com>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,11 @@ impl TryFrom<pb::sync::SyncAuth> for SyncAuth {
|
||||||
.endpoint
|
.endpoint
|
||||||
.map(|v| {
|
.map(|v| {
|
||||||
Url::try_from(v.as_str())
|
Url::try_from(v.as_str())
|
||||||
|
// Without the next line, incomplete URLs like computer.local without the http://
|
||||||
|
// are detected but URLs like computer.local:8000 are not.
|
||||||
|
// By calling join() now, these URLs are detected too and later code that
|
||||||
|
// uses and unwraps the result of join() doesn't panic
|
||||||
|
.and_then(|x| x.join("/"))
|
||||||
.or_invalid("Invalid sync server specified. Please check the preferences.")
|
.or_invalid("Invalid sync server specified. Please check the preferences.")
|
||||||
})
|
})
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
|
|
Loading…
Reference in a new issue