From f2f70556922d006af212d3cd977450e8d140ee84 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 26 Jun 2020 00:11:38 -0400 Subject: [PATCH] Improve source references for binary items. Since we binary items are probably annexed it is not particularly helpful to provide direct links to the symlink in the repository, as this contains basically zero helpful information. Instead, let's link to the metadata file when available as that should at least contain _something_ interesting. --- lib/helpers.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/helpers.rb b/lib/helpers.rb index 7425075..acaa612 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -35,12 +35,10 @@ end def item_source(item = @item) filename = "content" + item.identifier + filebase = filename.chomp(File.extname(filename)) - if File.file? filename then - return filename - end - - return nil + [ if item.binary? then filebase + ".yaml" end, + filename].compact.find { |f| File.file? f } end def item_uri(item = @item, rep: :default) -- 2.43.0