Skip to content

Commit

Permalink
[B] Add option to use source filename for document ingestion
Browse files Browse the repository at this point in the history
  • Loading branch information
1aurend authored and zdavis committed Feb 21, 2024
1 parent 2735239 commit 6043dea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/app/services/ingestions/strategy/document/inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6043dea

Please sign in to comment.