Skip to content

fix: fetch_url: return err on non 2xx reponses #6814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WofWca
Copy link
Collaborator

@WofWca WofWca commented Apr 20, 2025

The main reason for this change is the app picker
that Delta Chat clients use, which utilizes
the fetch_url function.
Sometimes we get an error from the server,
but we have no way to figure out that it's an error,
other than inspecting the body, which we don't (and shouldn't) do.
This results in us attempting to send webxdc apps
that are not even valid .zip files.

Another, arguably even worse thing is that
we also put the error responses to the cache,
so it's not easy to recover from such an error.

So, let's just return an error if the response code
is not a successful response code.

@WofWca WofWca added bug Something is not working webxdc labels Apr 20, 2025
@WofWca WofWca force-pushed the wofwca/fetch_url-error-code branch from d18f0f2 to 0eb2fda Compare April 20, 2025 19:53
@link2xt
Copy link
Collaborator

link2xt commented Apr 22, 2025

The idea looks good except for seemingly unrelated TODOs/comments.

@WofWca
Copy link
Collaborator Author

WofWca commented Apr 22, 2025

LOL sorry, that was another approach I wanted to take. Let me remove it

The main reason for this change is the app picker
that Delta Chat clients use, which utilizes
the `fetch_url` function.
Sometimes we get an error from the server,
but we have no way to figure out that it's an error,
other than inspecting the body, which we don't (and shouldn't) do.
This results in us attempting to send webxdc apps
that are not even valid .zip files.

Another, arguably even worse thing is that
we also put the error responses to the cache,
so it's not easy to recover from such an error.

So, let's just return an error if the response code
is not a successful response code.
@WofWca WofWca force-pushed the wofwca/fetch_url-error-code branch from 0eb2fda to db77699 Compare April 22, 2025 15:56
@WofWca
Copy link
Collaborator Author

WofWca commented Apr 22, 2025

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working webxdc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants