Right now there are a few bugs trying to turn relative links with a # in them into valid links using our various parsers. This is a combination of assuming anything that starts with a # is an anchor in goldmark.go and not escaping the filename in util.URLJoin.
Some test cases to fix for reference:
https://try.gitea.io/mrsdizzie/testcase/src/branch/master/%231readme.md
https://try.gitea.io/mrsdizzie/testcase/src/branch/master/my%231readme.md