FIX: Invalid URLs could raise exceptions when calling UelHelper.rails_route_from_url (PR #10782)

Original PR from @nbianca FIX: Invalid URLs could raise unwanted exceptions by nbianca · Pull Request #10762 · discourse/discourse · GitHub


Upload.secure_media_url? raised an exceptions when the URL was invalid, which was a issue in some situations where secure media URLs must be removed.

For example, sending digests used PrettyText.strip_secure_media, which used Upload.secure_media_url? to replace secure media with placeholders. If the URL was invalid, then an exception would be raised and left unhandled.

GitHub

The title of this pull request changed from “FIX: Invalid URLs could raise exceptions when calling rails_route_from_url” to "FIX: Invalid URLs could raise exceptions when calling UelHelper.rails_route_from_url