Skip to content

Commit

Permalink
Merge pull request #1779 from datadryad/3269-filesize-mismatches
Browse files Browse the repository at this point in the history
fixed file size issue
  • Loading branch information
ahamelers authored Jul 23, 2024
2 parents af811ef + d65a392 commit 9fd13ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/javascript/react/containers/UploadFiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export default function UploadFiles({
};

const addFilesHandler = (event, uploadType) => {
const timestamp = Date.now();
displayAriaMsg('Your files are being checked');
setWarning(null);
setSubmitDisabled(true);
Expand All @@ -294,7 +295,7 @@ export default function UploadFiles({
displayAriaMsg('Your files were added and are pending upload.');
// TODO: make a function?; future: unify adding file attributes
const newFiles = files.map((file, index) => {
file.id = `pending${chosenFiles.length + index}`;
file.id = `pending${timestamp + index / 1000}`;
file.sanitized_name = sanitize(file.name);
file.status = 'Pending';
file.url = null;
Expand Down Expand Up @@ -337,8 +338,8 @@ export default function UploadFiles({
},
).then((response) => {
const {new_file} = response.data;
setChosenFiles((cf) => cf.map((c, i) => {
if (i === index) {
setChosenFiles((cf) => cf.map((c) => {
if (c.name === new_file.original_filename) {
c.id = new_file.id;
c.sanitized_name = new_file.upload_file_name;
c.status = 'Uploaded';
Expand Down

0 comments on commit 9fd13ad

Please sign in to comment.