0002-adds-file-equality-check-to-deduplication-hook.patch

Jens Krämer, 2017-03-02 08:36

Download (1.24 KB)

View differences:

app/models/attachment.rb
398 398
                      .first
399 399

  
400 400
        original_diskfile = self.diskfile
401
        self.update_columns disk_directory: existing.disk_directory,
402
                            disk_filename: existing.disk_filename
403
        File.delete(original_diskfile) if File.exist?(original_diskfile)
401
        existing_diskfile = existing.diskfile
402

  
403
        if File.readable?(original_diskfile) &&
404
          File.readable?(existing_diskfile) &&
405
          FileUtils.identical?(original_diskfile, existing_diskfile)
406

  
407
          self.update_columns disk_directory: existing.disk_directory,
408
                              disk_filename: existing.disk_filename
409
          File.delete(original_diskfile)
410
        end
404 411
      end
405 412
    end
406 413
  end
407
-