Fix possible panic (#17694)
Fix possible panic (#17694)

- The code will get the first and second character `link[{0,1]]`.
However in a rare case the `link` could have 1 character and thus the
`link[1]` will create a panic.
go-gitea/gitea,go-gitea/gitea,go-gitea/gitea