0003-change-MD5-table-header-to-Checksum.patch

updated version of patch 3 including the display of digest type for each file - Jens Krämer, 2017-03-12 00:56

Download (2.43 KB)

View differences:

app/models/attachment.rb
404 404
    self.class.extension_in?(File.extname(filename), extensions)
405 405
  end
406 406

  
407
  # returns either MD5 or SHA256 depending on the way self.digest was computed
408
  def digest_type
409
    digest.size < 64 ? "MD5" : "SHA256" if digest.present?
410
  end
411

  
407 412
  private
408 413

  
409 414
  # Physically deletes the file from the file system
app/views/files/index.html.erb
12 12
    <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %>
13 13
    <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %>
14 14
    <%= sort_header_tag('downloads', :caption => l(:label_downloads_abbr), :default_order => 'desc') %>
15
    <th>MD5</th>
15
    <th><%= l(:label_checksum) %></th>
16 16
    <th></th>
17 17
  </tr></thead>
18 18
  <tbody>
......
31 31
    <td class="created_on"><%= format_time(file.created_on) %></td>
32 32
    <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
33 33
    <td class="downloads"><%= file.downloads %></td>
34
    <td class="digest"><%= file.digest %></td>
34
    <td class="digest"><%= file.digest_type %>: <%= file.digest %></td>
35 35
    <td class="buttons">
36 36
    <%= link_to(image_tag('delete.png'), attachment_path(file),
37 37
                                         :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
config/locales/en.yml
1014 1014
  label_font_default: Default font
1015 1015
  label_font_monospace: Monospaced font
1016 1016
  label_font_proportional: Proportional font
1017
  label_checksum: Checksum
1017 1018

  
1018 1019
  button_login: Login
1019 1020
  button_submit: Submit
1020
-