Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e67a5426
Commit
e67a5426
authored
Apr 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
480a0dc1
fcc771ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
changelogs/unreleased/sh-fix-realtime-changes-with-reserved-words.yml
...nreleased/sh-fix-realtime-changes-with-reserved-words.yml
+5
-0
lib/gitlab/etag_caching/router.rb
lib/gitlab/etag_caching/router.rb
+12
-11
spec/lib/gitlab/etag_caching/router_spec.rb
spec/lib/gitlab/etag_caching/router_spec.rb
+18
-0
No files found.
changelogs/unreleased/sh-fix-realtime-changes-with-reserved-words.yml
0 → 100644
View file @
e67a5426
---
title
:
Fix real-time updates for projects that contain a reserved word
merge_request
:
27060
author
:
type
:
fixed
lib/gitlab/etag_caching/router.rb
View file @
e67a5426
...
...
@@ -17,50 +17,51 @@ module Gitlab
new environments]
.
freeze
RESERVED_WORDS
=
Gitlab
::
PathRegex
::
ILLEGAL_PROJECT_PATH_WORDS
-
USED_IN_ROUTES
RESERVED_WORDS_REGEX
=
Regexp
.
union
(
*
RESERVED_WORDS
.
map
(
&
Regexp
.
method
(
:escape
)))
RESERVED_WORDS_PREFIX
=
%Q(^(?!.*
\/
(
#{
RESERVED_WORDS_REGEX
}
)
\/
).*)
ROUTES
=
[
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/noteable/issue/
\d
+/notes
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/noteable/issue/
\d
+/notes
\z
)
,
'issue_notes'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/issues/
\d
+/realtime_changes
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/issues/
\d
+/realtime_changes
\z
)
,
'issue_title'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/commit/
\S
+/pipelines
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/commit/
\S
+/pipelines
\.
json
\z
)
,
'commit_pipelines'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/merge_requests/new
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/merge_requests/new
\.
json
\z
)
,
'new_merge_request_pipelines'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/merge_requests/
\d
+/pipelines
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/merge_requests/
\d
+/pipelines
\.
json
\z
)
,
'merge_request_pipelines'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/pipelines
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/pipelines
\.
json
\z
)
,
'project_pipelines'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/pipelines/
\d
+
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/pipelines/
\d
+
\.
json
\z
)
,
'project_pipeline'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/builds/
\d
+
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/builds/
\d
+
\.
json
\z
)
,
'project_build'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/environments
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/environments
\.
json
\z
)
,
'environments'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/import/github/realtime_changes
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/import/github/realtime_changes
\.
json
\z
)
,
'realtime_changes_import_github'
),
Gitlab
::
EtagCaching
::
Router
::
Route
.
new
(
%r(
^(?!.*(
#{
RESERVED_WORDS_REGEX
}
)).*
/import/gitea/realtime_changes
\.
json
\z
)
,
%r(
#{
RESERVED_WORDS_PREFIX
}
/import/gitea/realtime_changes
\.
json
\z
)
,
'realtime_changes_import_gitea'
)
].
freeze
...
...
spec/lib/gitlab/etag_caching/router_spec.rb
View file @
e67a5426
...
...
@@ -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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment