summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-22 09:09:23 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-22 09:09:23 +0000
commit058c34839488502fcec48d805b83728f928a318c (patch)
treecda53ab73e010b3504f84767b61a0fab8c39f623
parent92482bb9019a38c80e671eee5e669440fd1eddf8 (diff)
downloadgitlab-ce-058c34839488502fcec48d805b83728f928a318c.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--changelogs/unreleased/fix-openapi-file-detector.yml5
-rw-r--r--lib/gitlab/file_detector.rb2
-rw-r--r--spec/lib/gitlab/file_detector_spec.rb15
3 files changed, 3 insertions, 19 deletions
diff --git a/changelogs/unreleased/fix-openapi-file-detector.yml b/changelogs/unreleased/fix-openapi-file-detector.yml
deleted file mode 100644
index 7793df62e77..00000000000
--- a/changelogs/unreleased/fix-openapi-file-detector.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Fix OpenAPI file detector
-merge_request: 27321
-author: Roger Meier
-type: fixed
diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb
index 351d5096132..305fbeecce1 100644
--- a/lib/gitlab/file_detector.rb
+++ b/lib/gitlab/file_detector.rb
@@ -40,7 +40,7 @@ module Gitlab
yarn_lock: 'yarn.lock',
# OpenAPI Specification files
- openapi: %r{([^\/]+)*(openapi|swagger)([^\/]+)*\.(yaml|yml|json)\z}i
+ openapi: %r{.*(openapi|swagger).*\.(yaml|yml|json)\z}i
}.freeze
# Returns an Array of file types based on the given paths.
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb
index 5bf70ef898a..3972bd24e80 100644
--- a/spec/lib/gitlab/file_detector_spec.rb
+++ b/spec/lib/gitlab/file_detector_spec.rb
@@ -96,25 +96,14 @@ describe Gitlab::FileDetector do
'swagger.yml', 'swagger.yaml', 'swagger.json',
'gitlab_swagger.yml', 'openapi_gitlab.yml',
'OpenAPI.YML', 'openapi.Yaml', 'openapi.JSON',
- 'openapi.gitlab.yml', 'gitlab.openapi.yml',
- 'attention/openapi.yml', 'attention/swagger.yml',
- 'attention/gitlab_swagger.yml', 'attention/openapi_gitlab.yml',
- 'openapi/openapi.yml', 'openapi/swagger.yml',
- 'openapi/my_openapi.yml', 'openapi/swagger_one.yml'
+ 'openapi.gitlab.yml', 'gitlab.openapi.yml'
]
openapi_types.each do |type_name|
expect(described_class.type_of(type_name)).to eq(:openapi)
end
- openapi_bad_types = [
- 'openapiyml',
- 'openapi/attention.yaml', 'swagger/attention.yaml'
- ]
-
- openapi_bad_types.each do |type_name|
- expect(described_class.type_of(type_name)).to be_nil
- end
+ expect(described_class.type_of('openapiyml')).to be_nil
end
end
end