Skip to content

Commit ce7b33c

Browse files
committed
Merge pull request flowjs#109 from Karankang007/master
feat: allow reupload of same file once the upload is complete
2 parents ec50b09 + f95d36d commit ce7b33c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/flow.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* @param {string|Function} [opts.testMethod]
2424
* @param {string|Function} [opts.uploadMethod]
2525
* @param {bool} [opts.prioritizeFirstAndLastChunk]
26+
* @param {bool} [opts.allowDuplicateUploads]
2627
* @param {string|Function} [opts.target]
2728
* @param {number} [opts.maxChunkRetries]
2829
* @param {number} [opts.chunkRetryInterval]
@@ -82,6 +83,7 @@
8283
testMethod: 'GET',
8384
uploadMethod: 'POST',
8485
prioritizeFirstAndLastChunk: false,
86+
allowDuplicateUploads: false,
8587
target: '/',
8688
testChunks: true,
8789
generateUniqueIdentifier: null,
@@ -574,9 +576,9 @@
574576
// Uploading empty file IE10/IE11 hangs indefinitely
575577
// see https://connect.microsoft.com/IE/feedback/details/813443/uploading-empty-file-ie10-ie11-hangs-indefinitely
576578
// Directories have size `0` and name `.`
577-
// Ignore already added files
579+
// Ignore already added files if opts.allowDuplicateUploads is set to false
578580
if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.')) &&
579-
!this.getFromUniqueIdentifier(this.generateUniqueIdentifier(file))) {
581+
(this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(this.generateUniqueIdentifier(file)))) {
580582
var f = new FlowFile(this, file);
581583
if (this.fire('fileAdded', f, event)) {
582584
files.push(f);

0 commit comments

Comments
 (0)