diff --git a/api/app/services/ingestions/strategy/document/inspector.rb b/api/app/services/ingestions/strategy/document/inspector.rb index c94eb3f14d..c2c60b1056 100644 --- a/api/app/services/ingestions/strategy/document/inspector.rb +++ b/api/app/services/ingestions/strategy/document/inspector.rb @@ -18,6 +18,7 @@ def title dublin_core_metadata("dc.title") || first_tag_content("title") || header_with_title_class_content || + original_filename || File.basename(source, ".*").titleize end @@ -113,6 +114,13 @@ def source end end + def original_filename + return if ingestion.external_source_url.present? + + filename = ingestion.source_data.with_indifferent_access[:metadata][:filename] + File.basename(filename, ".*").titleize + end + def basename "index.html" end