Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/hack4impact/3dp4me/D1FB6JAxg1e7adxbasPURNu1ERX3 |
mattwalo32
left a comment
There was a problem hiding this comment.
Good stuff, just some small changes
|
Does this current version work locally for you. I'm running this locally and it doesn't seem to handle more than 1 duplicate file |
|
It looks like uploading a duplicated filename doesn't trigger a POST request to upload the file |
|
hmm seems to work for me locally. i upload a file, hit save, then upload the file again. |
|
wait, it only works when i shuffle between tabs before uploading each subsequent file. the post request is only triggered the first time after i hit the tab, then doesn't trigger when i try uploading more files unless i switch to another tab then switch back ^hm this only happens when I try uploading the same file but works fine for any other file lemme take a look |
yousefa00
left a comment
There was a problem hiding this comment.
Left some comments, great work, Gene :D
| var updatedFileName = filename; | ||
| var file = ''; | ||
| var suffix = ''; |
| file = filename.split('.')[0]; | ||
| suffix = '.' + filename.split('.')[1]; |
There was a problem hiding this comment.
This won't work for files with multiple . like .styles.js maybe use lastIndexOf() and substring to split around the last .
| file = filename; | ||
| } | ||
| if (data.filter((e) => e.filename === filename).length > 0) { | ||
| var numPrev = 1; |
| } else { | ||
| file = filename; | ||
| } | ||
| if (data.filter((e) => e.filename === filename).length > 0) { |
There was a problem hiding this comment.
I would use if (data.some()) instead of filter since it's much clearer
| const modifiedFileName = await modifyFileName( | ||
| fileName, | ||
| stepData[fieldKey], | ||
| ); |
There was a problem hiding this comment.
If I were looking at this without context, i wouldnt understand what this function does. Think a one line comment explaining what this function does would be super helpful!
|
Also this is the library i found: https://www.npmjs.com/package/uniquefilename |
764275a to
a7a4f5f
Compare
Status:
🚀 Ready
Description
Handles duplicate file uploads by appending subscripts.
Fixes #59
Todos