From 6811adafd5e98e1c058f6493072a66d74494387f Mon Sep 17 00:00:00 2001
From: Stan Hu <stanhu@gmail.com>
Date: Sat, 1 Apr 2017 12:40:59 -0700
Subject: [PATCH] Relax constraint on Wiki IDs, since subdirectories can
 contain spaces

If a subdirectory contains spaces, GitLab would be unable to generate
the route in the sidebar, resulting in an Error 500.

Closes #30357
---
 changelogs/unreleased/sh-relax-wiki-slug-constraint.yml | 4 ++++
 config/routes/wiki.rb                                   | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 changelogs/unreleased/sh-relax-wiki-slug-constraint.yml

diff --git a/changelogs/unreleased/sh-relax-wiki-slug-constraint.yml b/changelogs/unreleased/sh-relax-wiki-slug-constraint.yml
new file mode 100644
index 00000000000..08395b0d28c
--- /dev/null
+++ b/changelogs/unreleased/sh-relax-wiki-slug-constraint.yml
@@ -0,0 +1,4 @@
+---
+title: Relax constraint on Wiki IDs, since subdirectories can contain spaces
+merge_request:
+author:
diff --git a/config/routes/wiki.rb b/config/routes/wiki.rb
index a6b3f5d4693..c2da84ff6f2 100644
--- a/config/routes/wiki.rb
+++ b/config/routes/wiki.rb
@@ -1,5 +1,3 @@
-WIKI_SLUG_ID = { id: /\S+/ }.freeze unless defined? WIKI_SLUG_ID
-
 scope(controller: :wikis) do
   scope(path: 'wikis', as: :wikis) do
     get :git_access
@@ -8,7 +6,7 @@ scope(controller: :wikis) do
     post '/', to: 'wikis#create'
   end
 
-  scope(path: 'wikis/*id', as: :wiki, constraints: WIKI_SLUG_ID, format: false) do
+  scope(path: 'wikis/*id', as: :wiki, format: false) do
     get :edit
     get :history
     post :preview_markdown
-- 
2.30.9