Skip to content

Rejected urls#1990

Merged
thomas-zahner merged 5 commits intolycheeverse:masterfrom
thomas-zahner:rejected-urls
Jan 20, 2026
Merged

Rejected urls#1990
thomas-zahner merged 5 commits intolycheeverse:masterfrom
thomas-zahner:rejected-urls

Conversation

@thomas-zahner
Copy link
Member

Fixes #1980

Supersedes #1982

@katrinafyi This change should suffice to achieve the same thing as in #1982 but without changing error handling much or introducing the magic/sentinel value.

@katrinafyi
Copy link
Member

katrinafyi commented Jan 15, 2026

yeah, seems simpler!

edit: what do you think about adding a case so ErrorKind::BuildRequestClient can get mapped to timeout and unsupported statuses? it would match the old behaviour in cases aside from data URIs

basically, just

+     ErrorKind::BuildRequestClient(e) => Status::from(e),

@thomas-zahner
Copy link
Member Author

thomas-zahner commented Jan 15, 2026

@katrinafyi Hmm that might make sense.

it would match the old behaviour

Do you have an example of that, or could you point me to a specific line? I don't remember having changed that 😅
We would ideally add a test which covers that case too, as documentation.

@katrinafyi
Copy link
Member

katrinafyi commented Jan 19, 2026

@thomas-zahner I tried a few things and don't have a concrete example, sadly. But it's the same premise as I wrote in the description of #1982, and the line change would look like the change to lychee-lib/src/types/status.rs here: rina-forks@5bcd700

The idea is that if you have a reqwest::Error, there are different ways to end up at a lychee Status. At the moment, some reqwest::Error will lead to a different Status depending on what path you take. I think this can be subtle and surprising, especially given implicit conversions within ? operator.

I think that either the two paths should be made to be logically the same (by adding this extra case), or the reqwest::Error → Status edge should be deleted and it all goes through ErrorKind first.

flowchart LR

reqwest::Error -->|Into| ErrorKind
reqwest::Error -->|Into| Status
ErrorKind -->|Into| Status
Loading

@thomas-zahner
Copy link
Member Author

@katrinafyi Thank you very much for the explanation. The diagram really helps!

What do you think if we just remove (or rather inline) the conversion from reqwest:Error to Status, this feels pretty clean. Also I realised that this conversion wasn't even used except for one place.

See 136913b

@katrinafyi
Copy link
Member

@thomas-zahner looks good!

@thomas-zahner thomas-zahner merged commit 34199a4 into lycheeverse:master Jan 20, 2026
7 checks passed
This was referenced Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data: URLs rejected by latest

2 participants