diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-04 21:09:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-04 21:09:22 +0300 |
commit | 7c221ba5ce130ca50b892e6dd32783e1327718df (patch) | |
tree | 2c11d688f89886c8ea37638061fe450c8b656e47 /app/models/dependency_proxy | |
parent | da602b32e45431234e592e8f7001c3ace1771765 (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 |