lib/onebox/engine/pdf_onebox.rb in onebox-1.8.17 vs lib/onebox/engine/pdf_onebox.rb in onebox-1.8.18

- old
+ new

@@ -22,10 +22,13 @@ end def get_pdf_info uri = URI.parse(@url) size = Onebox::Helpers.fetch_content_length(@url) - return {filesize: Onebox::Helpers.pretty_filesize(size.to_i), name: File.basename(uri.path)} + return { + filesize: size ? Onebox::Helpers.pretty_filesize(size.to_i) : nil, + name: File.basename(uri.path) + } rescue nil end end end