Skip to content

Commit

Permalink
Wrong file size when uploading documents #1556
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Oct 18, 2024
1 parent 22510b9 commit e0482fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/views/dmsf_upload/_upload_file.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<%= hidden_field_tag "committed_files[#{i}][disk_filename]", upload.disk_filename %>
<%= hidden_field_tag "committed_files[#{i}][token]", upload.token %>
<%= hidden_field_tag "committed_files[#{i}][digest]", upload.digest %>
<%= hidden_field_tag "committed_files[#{i}][size]", upload.size %>
<div class="splitcontent">
<div class="splitcontentleft">
<p>
Expand Down Expand Up @@ -56,8 +57,8 @@
<%= text_field_tag "committed_files[#{i}][mime_type]", h(upload.mime_type), readonly: true %>
</p>
<p>
<%= label_tag "committed_files[#{i}][size]", l(:label_size) %>
<%= text_field_tag "committed_files[#{i}][size]", number_to_human_size(upload.size), readonly: true %>
<%= label_tag "committed_files[#{i}][human_size]", l(:label_size) %>
<%= text_field_tag "committed_files[#{i}][human_size]", number_to_human_size(upload.size), readonly: true %>
</p>
</div>
<div class="splitcontentright">
Expand Down
4 changes: 2 additions & 2 deletions app/views/dmsf_upload/_upload_file_locked.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<%= text_field_tag "committed_files[#{i}][mime_type]", upload.mime_type, readonly: true %>
</p>
<p>
<%= label_tag "committed_files[#{i}][size]", l(:label_size) %>
<%= text_field_tag "committed_files[#{i}][size]", number_to_human_size(upload.size), readonly: true %>
<%= label_tag "committed_files[#{i}][human_size]", l(:label_size) %>
<%= text_field_tag "committed_files[#{i}][human_size]", number_to_human_size(upload.size), readonly: true %>
</p>
</div>
<div class="splitcontentright">
Expand Down
6 changes: 4 additions & 2 deletions assets/javascripts/attachments_dmsf.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ function dmsfAddFile(inputEl, file, eagerUpload) {
detailsForm = detailsForm.replace('id="committed_files_' + attachmentId + '_title"',
'id="committed_files_' + attachmentId + '_title" value = "' + filenameToTitle(file.name) + '"');
// Size
detailsForm = detailsForm.replace('id="committed_files_' + attachmentId + '_size"',
'id="committed_files_' + attachmentId + '_size" value = "' + humanFileSize(file.size) + '"');
detailsForm = detailsForm.replace('id="committed_files_' + attachmentId + '_human_size"',
'id="committed_files_' + attachmentId + '_human_size" value = "' + humanFileSize(file.size) + '"');
detailsForm = detailsForm.replace('id="committed_files_' + attachmentId + '_size" value="0"',
'id="committed_files_' + attachmentId + '_size" value = "' + file.size + '"');
// Mime type
detailsForm = detailsForm.replace('id="committed_files_' + attachmentId + '_mime_type"',
'id="committed_files_' + attachmentId + '_mime_type" value = "' + file.type + '"');
Expand Down

0 comments on commit e0482fe

Please sign in to comment.