]> cat aescling's git repositories - mastodon.git/commitdiff
Fix downloading remote media files when server returns empty filename (#14867)
authorThibG <thib@sitedethib.com>
Sun, 27 Sep 2020 20:00:43 +0000 (22:00 +0200)
committerGitHub <noreply@github.com>
Sun, 27 Sep 2020 20:00:43 +0000 (22:00 +0200)
Fixes #14817

lib/paperclip/response_with_limit_adapter.rb

index 8711b13497a0391a30c0593731292e63bb20618e..17a2abd25f2c79af2a80473bdb8a6f5a3760b61b 100644 (file)
@@ -16,7 +16,7 @@ module Paperclip
     private
 
     def cache_current_values
-      @original_filename = filename_from_content_disposition || filename_from_path || 'data'
+      @original_filename = filename_from_content_disposition.presence || filename_from_path.presence || 'data'
       @size = @target.response.content_length
       @tempfile = copy_to_tempfile(@target)
       @content_type = ContentTypeDetector.new(@tempfile.path).detect