miniflux / v2

Minimalist and opinionated feed reader
https://miniflux.app
Apache License 2.0
6.97k stars 727 forks source link

fix(client): Return nil and error if endpoint is empty string #2773

Closed akosiaris closed 3 months ago

akosiaris commented 3 months ago

Why: Passing an empty string as an endpoint to Client when instantiating a new client might seem like something that should never happen but I managed to trigger it while parsing some input files to register feeds in bulk.

What: In the execute() function, check early if the endpoint is "" and then return immediately nil and a new error, named ErrWrongEndpoint with a descriptive string

Do you follow the guidelines?

akosiaris commented 3 months ago

Taking a quick look, I think your solution is better than mine. As long as no Client's endpoint field is used outside of a request context, it shoud work fine.

I 'll try and code it, run it for a few days and then get back to you.

Thanks for the suggestion!

akosiaris commented 3 months ago

Updated per your suggestion. I came up with the error name and string but happy to alter name and wording.