Skip to content
Snippets Groups Projects
Commit 8ad82e5e authored by Mayra Cabrera's avatar Mayra Cabrera Committed by 🤖 GitLab Bot 🤖
Browse files

Merge branch 'ac-63020-typeerror-nil-can-t-be-coerced-into-integer' into 'master'

Fix nil coercion updating storage size on project statistics

See merge request gitlab-org/gitlab-ce!29425

(cherry picked from commit d5e8e1ef)

f67e1bec Fix nil coercion updating storage size 
11790387 Add a test case
parent 7545d5de
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -54,7 +54,7 @@ class ProjectStatistics < ApplicationRecord
end
 
def update_storage_size
self.storage_size = repository_size + wiki_size + lfs_objects_size + build_artifacts_size + packages_size
self.storage_size = repository_size + wiki_size.to_i + lfs_objects_size + build_artifacts_size + packages_size
end
 
# Since this incremental update method does not call update_storage_size above,
Loading
Loading
---
title: Fix nil coercion updating storage size on project statistics
merge_request: 29425
author:
type: fixed
Loading
Loading
@@ -197,6 +197,18 @@ describe ProjectStatistics do
 
expect(statistics.storage_size).to eq 9
end
it 'works during wiki_size backfill' do
statistics.update!(
repository_size: 2,
wiki_size: nil,
lfs_objects_size: 3
)
statistics.reload
expect(statistics.storage_size).to eq 5
end
end
 
describe '.increment_statistic' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment