Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-04-07 18:58:12 +0300
committerStan Hu <stanhu@gmail.com>2015-04-07 19:10:11 +0300
commit3143edfea6b71a6a26470e3f4a9cffa773f584ec (patch)
tree54988bcedb2d9300e40803c71498f36602c9496a /app/helpers/wiki_helper.rb
parent7feec5fe051172ee055f3c82da22b1b330e13c74 (diff)
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.rb22
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