Skip to content

Commit

Permalink
disc report: better error for missing container name or manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay committed Aug 22, 2019
1 parent 9d83cd6 commit 0f48e8d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/services/discovery_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ def process_dobj(dobj)

if using_media_manifest? # if we are using a media manifest, let's add how many files were found
bundle_id = File.basename(dobj.container)
cm_files = media.manifest[bundle_id].fetch(:files, [])
counts[:files_in_manifest] = cm_files.count
relative_paths = dobj.object_files.map(&:relative_path)
counts[:files_found] = (cm_files.pluck(:filename) & relative_paths).count
errors[:empty_manifest] = true unless counts[:files_in_manifest] > 0
errors[:files_found_mismatch] = true unless counts[:files_in_manifest] == counts[:files_found]
if bundle_id && media.manifest[bundle_id]
cm_files = media.manifest[bundle_id].fetch(:files, [])
counts[:files_in_manifest] = cm_files.count
relative_paths = dobj.object_files.map(&:relative_path)
counts[:files_found] = (cm_files.pluck(:filename) & relative_paths).count
errors[:empty_manifest] = true unless counts[:files_in_manifest] > 0
errors[:files_found_mismatch] = true unless counts[:files_in_manifest] == counts[:files_found]
else
errors[:missing_container_name_or_manifest] = true
end
end

errors[:empty_object] = true unless counts[:total_size] > 0
Expand Down

0 comments on commit 0f48e8d

Please sign in to comment.