diff options
Diffstat (limited to 'app/models/packages')
-rw-r--r-- | app/models/packages/package.rb | 1 | ||||
-rw-r--r-- | app/models/packages/rpm/repository_file.rb | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb index 317db51f4ef..17c5415939c 100644 --- a/app/models/packages/package.rb +++ b/app/models/packages/package.rb @@ -149,6 +149,7 @@ class Packages::Package < ApplicationRecord end scope :preload_composer, -> { preload(:composer_metadatum) } scope :preload_npm_metadatum, -> { preload(:npm_metadatum) } + scope :preload_pypi_metadatum, -> { preload(:pypi_metadatum) } scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) } diff --git a/app/models/packages/rpm/repository_file.rb b/app/models/packages/rpm/repository_file.rb index 4b5fa59c6ee..614ec9b3e56 100644 --- a/app/models/packages/rpm/repository_file.rb +++ b/app/models/packages/rpm/repository_file.rb @@ -8,6 +8,8 @@ module Packages include Packages::Installable INSTALLABLE_STATUSES = [:default].freeze + FILELISTS_FILENAME = 'filelists.xml' + FILELISTS_SIZE_LIMITATION = 20.megabytes enum status: { default: 0, pending_destruction: 1, processing: 2, error: 3 } @@ -20,6 +22,14 @@ module Packages mount_file_store_uploader Packages::Rpm::RepositoryFileUploader update_project_statistics project_statistics_name: :packages_size + + def self.has_oversized_filelists?(project_id:) + where( + project_id: project_id, + file_name: FILELISTS_FILENAME, + size: [FILELISTS_SIZE_LIMITATION..] + ).exists? + end end end end |