Skip to content

Too-eager urlencoding for find files links

Summary

In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31311/diffs we started urlencoding the path of files shown in, e.g., https://gitlab.com/gitlab-org/gitlab-development-kit/find_file/master

This is great, and makes thje files accessible, but we've ended up also encoding the path separator, which is unnecessary and slightly ugly

Steps to reproduce

What is the current bug behavior?

/ characters are converted to %2F, which is a little unpretty.

What is the expected correct behavior?

This particular URL works, but so does https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/.gitlab/CODEOWNERS - and that's prettier and more readable.

Output of checks

This bug happens on GitLab.com

Possible fixes

If we split the path into its components, encoded each of those separately, then joined it back together again, we'd instead get the (still-working, and used elsewhere) URL suggested above.