diff options
author | Stan Hu <stanhu@gmail.com> | 2019-01-22 17:49:26 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-01-22 17:56:25 -0800 |
commit | 494e00caa3c24480592833cf1b223e34c1a2bfb2 (patch) | |
tree | d076abdde96e3875870907ae7dbe68712ceeef5b /lib | |
parent | 5cf994043fbf8669120e52f7fc345f9168a0d77b (diff) | |
download | gitlab-ce-494e00caa3c24480592833cf1b223e34c1a2bfb2.tar.gz |
Fix 404s for snippet uploads when relative URL root used
Personal snippet uploads have neither a group nor a project. If a GitLab
instance were configured with a relative URL root (e.g. `/gitlab`), then
the Markdown filter would not include this root in the generated path.
We fix this by adding this root if there is no group or project.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56280
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/relative_link_filter.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index 7acbc933adc..93e6d6470f1 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -58,6 +58,8 @@ module Banzai path_parts.unshift(relative_url_root, 'groups', group.full_path, '-') elsif project path_parts.unshift(relative_url_root, project.full_path) + else + path_parts.unshift(relative_url_root) end begin |