diff options
author | Stan Hu <stanhu@gmail.com> | 2019-04-05 08:17:30 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2019-04-05 11:59:20 -0700 |
commit | da0c9b005648cb683801ea8765f5f5f9fdb92c0c (patch) | |
tree | 3c593efe5e9a293a44347cbdef54e6fdbb460193 /spec | |
parent | 0912fd8ad203fce9f0d4a61b2dd24f1f34c5474e (diff) | |
download | gitlab-ce-da0c9b005648cb683801ea8765f5f5f9fdb92c0c.tar.gz |
Fix real-time updates for projects that contain a reserved word
Projects that included reserved words (e.g. test-create) would fail to
generate a proper ETag key because of the name. To fix this, we add
forward slashes to match the exact name so that /test-create doesn't get
matched, but /create does.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60113
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/etag_caching/router_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb index f69cb502ca6..a7cb0bb2a87 100644 --- a/spec/lib/gitlab/etag_caching/router_spec.rb +++ b/spec/lib/gitlab/etag_caching/router_spec.rb @@ -19,6 +19,24 @@ describe Gitlab::EtagCaching::Router do expect(result.name).to eq 'issue_title' end + it 'matches with a project name that includes a suffix of create' do + result = described_class.match( + '/group/test-create/issues/123/realtime_changes' + ) + + expect(result).to be_present + expect(result.name).to eq 'issue_title' + end + + it 'matches with a project name that includes a prefix of create' do + result = described_class.match( + '/group/create-test/issues/123/realtime_changes' + ) + + expect(result).to be_present + expect(result.name).to eq 'issue_title' + end + it 'matches project pipelines endpoint' do result = described_class.match( '/my-group/my-project/pipelines.json' |