Hmmm, the problem here seems to be that Ruby can’t parse those URLs:
URI.parse("https://riot.im/app/#/room/#safenetwork:matrix.org")
URI::InvalidURIError: bad URI(is not URI?): https://riot.im/app/#/room/#safenetwork:matrix.org
It honestly seems a bit odd to me to have two hashes in a URL like that.