quelea-projection / Quelea

Open source projection software for churches.
https://quelea.org
GNU General Public License v3.0
159 stars 145 forks source link

Allow `file` scheme urls #539

Closed chris-j-major closed 2 years ago

chris-j-major commented 2 years ago

This updates the handling of url's in the WebDisplayable component to accept local file url's.

The original code just checked that the url started with "http", and appended it if not, this check was duplicated in three locations. This check is now centralised in the WebDisplayable class (for lack of an obvious better option) as sanitiseUrl, and then reused in all three locations.

This function parses the URL using the standard Java parser, checks that the scheme is set, and recreates it using http if it does not (worth noting that this will use an unsecure connection if not specified, which is not great, however it keeps the existing behaviour).

This also means that a badly malformed URL will throw an exception, in this case we log it and default to https://quelea.org/ instead. This isn't great UX, however as this can happen without user involvement (e.g. selecting the WebDisplayable element, or loading a sequence, it seemed preferable than any other option.

resolves #537

chris-j-major commented 2 years ago

after 2022 is out then I'll try to put some more time aside to test more thoroughly.

Of course - of there anything specific that another pair of hands could help with to get 2022 released?

berry120 commented 2 years ago

@chris-j-major Not at the moment, but thanks for the offer :) Beta 3 has just been released and hopefully if there's no major regressions with that, we'll roll out the final version in the next few weeks.