Update regex for topic page to match any character
Previous regex used \w for alphanumeric characters but there is no
restriction in the characters that can be used in the topic name
including spaces and dashes.
Google-bug-id: b/201529567
Change-Id: Ia2f382ddc9f0e088a3b441bc11ad04e631176758
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
index 5fac268..c2f903f 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -85,7 +85,7 @@
DASHBOARD: /^\/dashboard\/(.+)$/,
// TODO(dhruvsri): remove /c once Change 322894 lands
- TOPIC: /^\/c\/topic\/(\w+)\/?$/,
+ TOPIC: /^\/c\/topic\/([^/]*)\/?$/,
CUSTOM_DASHBOARD: /^\/dashboard\/?$/,
PROJECT_DASHBOARD: /^\/p\/(.+)\/\+\/dashboard\/(.+)/,
LEGACY_PROJECT_DASHBOARD: /^\/projects\/(.+),dashboards\/(.+)/,
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.js b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.js
index 6462816..a7de155 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.js
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.js
@@ -1242,13 +1242,13 @@
suite('topic routes', () => {
test('_handleTopicRoute', () => {
- const url = '/c/topic/random/';
+ const url = '/c/topic/super complex-topic name with spaces/';
const groups = url.match(_testOnly_RoutePattern.TOPIC);
const data = {params: groups.slice(1)};
assertDataToParams(data, '_handleTopicRoute', {
view: GerritView.TOPIC,
- topic: 'random',
+ topic: 'super complex-topic name with spaces',
});
});
});