Manually escape '#' when building relative uris, closes #42459
What does this MR do?
Fixes a bug where a "#" in a relative URI would lead to the URI being wrongly printed in markdown.
This was due to Addressable not escaping '#', because it is indeed a valid character.
I've also tested this behaviour with every special character allowed in RFC 3986, which are also valid characters for ref-tags, by creating a branch named re'@],+;-,.,_,,,/,,#,,],@,!,$,&,',(,),,+,,,;
. The linking worked fine there, so I assume this behaviour only occurs when using a '#'. Consequently, the procedure used here should be sufficient.