fix: Return None if the key not found and not Some(None)

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-08-11 09:26:47 +00:00
parent d39f1e941a
commit d4c3558b97
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F

View file

@ -62,15 +62,15 @@ impl CaptchaFinder for CaptchaFormFinder {
async fn find_token(&self, req: &mut Request) -> Option<Option<String>> {
req.form_data()
.await
.map(|form| form.fields.get(&self.token_name).cloned())
.ok()
.and_then(|form| form.fields.get(&self.token_name).cloned().map(Some))
}
async fn find_answer(&self, req: &mut Request) -> Option<Option<String>> {
req.form_data()
.await
.map(|form| form.fields.get(&self.answer_name).cloned())
.ok()
.and_then(|form| form.fields.get(&self.answer_name).cloned().map(Some))
}
}