diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-22 21:10:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-22 21:10:55 +0300 |
commit | 57f6fa3cd786acb4ead4b7a2d3aa43b6c7abbc58 (patch) | |
tree | a0eea3428f23270d4d6f843e3459022f03243f16 /app/models/dependency_proxy | |
parent | 232e7582b0e81e95bd721ad8094fcb50ecbc8a04 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/dependency_proxy')
-rw-r--r-- | app/models/dependency_proxy/manifest.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/dependency_proxy/manifest.rb b/app/models/dependency_proxy/manifest.rb index f3c7f34e0d7..d613d5708f0 100644 --- a/app/models/dependency_proxy/manifest.rb +++ b/app/models/dependency_proxy/manifest.rb @@ -12,5 +12,10 @@ class DependencyProxy::Manifest < ApplicationRecord mount_file_store_uploader DependencyProxy::FileUploader - scope :find_or_initialize_by_file_name, ->(file_name) { find_or_initialize_by(file_name: file_name) } + def self.find_or_initialize_by_file_name_or_digest(file_name:, digest:) + result = find_by(file_name: file_name) || find_by(digest: digest) + return result if result + + new(file_name: file_name, digest: digest) + end end |