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
23eb7efa
Commit
23eb7efa
authored
Sep 23, 2020
by
Mathieu Parent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Debian Component Regexp
parent
fe471849
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
lib/api/debian_package_endpoints.rb
lib/api/debian_package_endpoints.rb
+2
-2
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-0
spec/lib/gitlab/regex_spec.rb
spec/lib/gitlab/regex_spec.rb
+13
-0
No files found.
lib/api/debian_package_endpoints.rb
View file @
23eb7efa
...
@@ -80,7 +80,7 @@ module API
...
@@ -80,7 +80,7 @@ module API
end
end
params
do
params
do
requires
:component
,
type:
String
,
desc:
'The Debian Component'
requires
:component
,
type:
String
,
desc:
'The Debian Component'
,
regexp:
Gitlab
::
Regex
.
debian_component_regex
requires
:architecture
,
type:
String
,
desc:
'The Debian Architecture'
,
regexp:
Gitlab
::
Regex
.
debian_architecture_regex
requires
:architecture
,
type:
String
,
desc:
'The Debian Architecture'
,
regexp:
Gitlab
::
Regex
.
debian_architecture_regex
end
end
...
@@ -99,7 +99,7 @@ module API
...
@@ -99,7 +99,7 @@ module API
end
end
params
do
params
do
requires
:component
,
type:
String
,
desc:
'The Debian Component'
requires
:component
,
type:
String
,
desc:
'The Debian Component'
,
regexp:
Gitlab
::
Regex
.
debian_component_regex
requires
:letter
,
type:
String
,
desc:
'The Debian Classification (first-letter or lib-first-letter)'
requires
:letter
,
type:
String
,
desc:
'The Debian Classification (first-letter or lib-first-letter)'
requires
:source_package
,
type:
String
,
desc:
'The Debian Source Package Name'
,
regexp:
Gitlab
::
Regex
.
debian_package_name_regex
requires
:source_package
,
type:
String
,
desc:
'The Debian Source Package Name'
,
regexp:
Gitlab
::
Regex
.
debian_package_name_regex
end
end
...
...
lib/gitlab/regex.rb
View file @
23eb7efa
...
@@ -90,6 +90,10 @@ module Gitlab
...
@@ -90,6 +90,10 @@ module Gitlab
@debian_distribution_regex
||=
%r{
\A
[a-z0-9][a-z0-9
\.
-]*
\z
}i
.
freeze
@debian_distribution_regex
||=
%r{
\A
[a-z0-9][a-z0-9
\.
-]*
\z
}i
.
freeze
end
end
def
debian_component_regex
@debian_component_regex
||=
%r{
#{
debian_distribution_regex
}
}
.
freeze
end
def
unbounded_semver_regex
def
unbounded_semver_regex
# See the official regex: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# See the official regex: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
...
...
spec/lib/gitlab/regex_spec.rb
View file @
23eb7efa
...
@@ -535,6 +535,19 @@ RSpec.describe Gitlab::Regex do
...
@@ -535,6 +535,19 @@ RSpec.describe Gitlab::Regex do
it
{
is_expected
.
not_to
match
(
'hé'
)
}
it
{
is_expected
.
not_to
match
(
'hé'
)
}
end
end
describe
'.debian_component_regex'
do
subject
{
described_class
.
debian_component_regex
}
it
{
is_expected
.
to
match
(
'main'
)
}
it
{
is_expected
.
to
match
(
'non-free'
)
}
# Do not allow slash
it
{
is_expected
.
not_to
match
(
'non/free'
)
}
# Do not allow Unicode
it
{
is_expected
.
not_to
match
(
'hé'
)
}
end
describe
'.semver_regex'
do
describe
'.semver_regex'
do
subject
{
described_class
.
semver_regex
}
subject
{
described_class
.
semver_regex
}
...
...
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