Previously we were escaping shortlinks before resolving them (and in-fact doing that twice!). That's wrong, we should instead be escaping the parameter for our default links but not escaping the resolved shortlinks (as for direct they are replaced entirely with created shortlinks and for regex the character set can be very restricted for matches).
Escaping as we were prevented links like a/b working