diff options
author | Robert Speicher <robert@gitlab.com> | 2015-11-15 21:25:20 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2015-11-15 21:25:20 +0300 |
commit | 3777b233a35509c4ed13e145624370884468cbc2 (patch) | |
tree | d6a2771f2c3224228b19a812cdd990d6f5655ffa | |
parent | aec9f211e534900f602e769dcdd6f69730849f92 (diff) | |
parent | 4bb99677b1ddee84ab0433efe081de8025e5aa53 (diff) |
Merge branch 'relative_links_default_branch' into 'master'
Relative links in project README should point to default branch, not master
Relative links in the README shown on a project's main page currently always point to the "master" branch. This is a particularly obvious problem for projects that have no "master" branch, since the link points to a non-existent file.
This patch changes the relative links to instead point to the default branch.
Resolves #2707, #1134, #1852
See merge request !1801
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/gitlab/markdown/relative_link_filter.rb | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 1bd60728e6f..5d22e950914 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -39,6 +39,7 @@ v 8.2.0 (unreleased) - Improve Continuous Integration graphs page - Make color of "Accept Merge Request" button consistent with current build status - Add ignore white space option in merge request diff and commit and compare view + - Relative links from a repositories README.md now link to the default branch v 8.1.4 - Fix bug where manually merged branches in a MR would end up with an empty diff (Stan Hu) diff --git a/lib/gitlab/markdown/relative_link_filter.rb b/lib/gitlab/markdown/relative_link_filter.rb index 6ee3d1ce039..632be4d7542 100644 --- a/lib/gitlab/markdown/relative_link_filter.rb +++ b/lib/gitlab/markdown/relative_link_filter.rb @@ -51,7 +51,7 @@ module Gitlab relative_url_root, context[:project].path_with_namespace, path_type(file_path), - ref || 'master', # assume that if no ref exists we can point to master + ref || context[:project].default_branch, # if no ref exists, point to the default branch file_path ].compact.join('/').squeeze('/').chomp('/') |