psst icon indicating copy to clipboard operation
psst copied to clipboard

Prevent from crashing when pasting into Last.fm key/secret textboxes

Open Pogodaanton opened this issue 6 months ago • 4 comments

fixes #611

I wouldn't know of a reason why lastfm_api_key_input and lastfm_api_secret_input shouldn't be checked for sameness. As far as I understand, if they are marked as ignore, pasting some larger text won't update the input field's inner data model properly, hence the panic.

Pogodaanton avatar Jun 14 '25 22:06 Pogodaanton

Hmm, I wasn't able to reproduce this issue before but the #[data(ignore)] was intentional because the input of these fields shouldn't be driving any comparison, we shouldn't be saving their content at all until we press the "Connect" button.

I think this is a Druid bug perhaps... and maybe we need to limit the length of this field (which is good anyway given that the API secret and key have well-know lengths).

jacksongoode avatar Jun 15 '25 16:06 jacksongoode

we shouldn't be saving their content at all until we press the "Connect" button

By saving you mean holding it in memory? I can hardly imagine that the Authentication struct is saved to disk as soon as it is updated. If it is, by that logic, access_token should also be flagged as ignore, no?

Pogodaanton avatar Jun 15 '25 19:06 Pogodaanton

I mean that the partial data saved within the field shouldn't be saved, these fields should only pass data in the attempt to authenticate with Last.fm. I think the solution can simply be to make sure the api and secret are the exact length needed by Last.fm. Would you be willing to make that edit?

jacksongoode avatar Jun 30 '25 11:06 jacksongoode

I mean that the partial data saved within the field shouldn't be saved, these fields should only pass data in the attempt to authenticate with Last.fm. I think the solution can simply be to make sure the api and secret are the exact length needed by Last.fm. Would you be willing to make that edit?

Hmm, I am unsure how to implement a length limiter for the TextBox in Druid. Can you maybe give me some pointers where I should look and what to consider?

Pogodaanton avatar Aug 03 '25 12:08 Pogodaanton