diff options
author | Stan Hu <stanhu@gmail.com> | 2015-04-07 08:58:12 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-04-07 09:10:11 -0700 |
commit | 3143edfea6b71a6a26470e3f4a9cffa773f584ec (patch) | |
tree | 54988bcedb2d9300e40803c71498f36602c9496a /app/helpers/wiki_helper.rb | |
parent | 7feec5fe051172ee055f3c82da22b1b330e13c74 (diff) | |
download | gitlab-ce-3143edfea6b71a6a26470e3f4a9cffa773f584ec.tar.gz |
Fix bug where Wiki pages that include a '/' were no longer accessible
Closes #1363
Diffstat (limited to 'app/helpers/wiki_helper.rb')
-rw-r--r-- | app/helpers/wiki_helper.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb new file mode 100644 index 00000000000..a3bc64c010e --- /dev/null +++ b/app/helpers/wiki_helper.rb @@ -0,0 +1,22 @@ +module WikiHelper + # Rails v4.1.9+ escapes all model IDs, converting slashes into %2F. The + # only way around this is to implement our own path generators. + def namespace_project_wiki_path(namespace, project, wiki_page, *args) + slug = + case wiki_page + when Symbol + wiki_page + else + wiki_page.slug + end + namespace_project_path(namespace, project) + "/wikis/#{slug}" + end + + def edit_namespace_project_wiki_path(namespace, project, wiki_page, *args) + namespace_project_wiki_path(namespace, project, wiki_page) + '/edit' + end + + def history_namespace_project_wiki_path(namespace, project, wiki_page, *args) + namespace_project_wiki_path(namespace, project, wiki_page) + '/history' + end +end |