fine-uploader icon indicating copy to clipboard operation
fine-uploader copied to clipboard

Internal _netUploadedOrQueued property can become incorrect

Open confusingstraw opened this issue 8 years ago • 2 comments

Type of issue [REQUIRED]

bug

Uploader type [REQUIRED]

traditional

Bug details [DELETE EVERYTHING IN THIS SECTION IF THIS IS A FEATURE REQUEST]

Fine Uploader version [REQUIRED]

5.11.10

Browsers where the bug is reproducible [REQUIRED]

Chrome (only one tested)

Operating systems where the bug is reproducible [REQUIRED]

Windows 7 (only one tested)

Exact steps required to reproduce the issue [REQUIRED]

  1. Select 2 files - _netUploadedOrQueued = 2
  2. Cancel one of the files: uploader.cancel(fileId) - _netUploadedOrQueued = 1
  3. Call uploader.cancelAll() - _netUploadedOrQueued = -1

All of your Fine Uploader initialization JavaScript code [REQUIRED]

new FineUploaderBasic({
    maxConnections: 1,
    autoUpload: false,
    request: {
      endpoint: this._uploadUrl,
      method: 'POST',
      forceMultipart: true,
      inputName: 'files[]',
    },
    deleteFile: { enabled: false },
    chunking: {
      mandatory: true,
      enabled: true,
      partSize: this._chunkSize,
    },
    resume: { enabled: false },
    cors: { sendCredentials: true },
    callbacks: {
      onUploadChunk: this._onUploadChunk.bind(this),
      onSubmit: this._onAddFile.bind(this),
      onCancel: this._onCancelFile.bind(this),
      onProgress: this._onUploadProgress.bind(this),
      onComplete: this._onComplete.bind(this),
      onError: this._onError.bind(this),
    },
  })

Detailed explanation of the problem [REQUIRED]

When using the uploader through its Core API, the internal counter can become out of sync with the files in the internal queue. It has not caused a problem with me yet, but I am only just starting to use the uploader (haven't even uploaded anything yet). Presumably there is some difference between the functionality of clearStoredFiles and cancelAll that should be fixed. I would assume cancel/cancelAll would be the inverse of add.

confusingstraw avatar Jan 13 '17 18:01 confusingstraw

Thanks for the report. Can you please fix the code formatting in your question?

This seems like an edge case, so it's unlikely that I will get a chance to look into it. But a pull request with a fix + tests will push this through faster.

The priority of this changes a bit if you can demonstrate an issue this causes. I'm also wondering if this is a timing issue. How much time elapses between steps 2 & 3? Must it be a small amount of time, or does that not matter?

rnicholus avatar Jan 13 '17 18:01 rnicholus

Sorry for the long delay, haven't had occasion to work with files in some time, so it totally slipped my mind. The issue occurs regardless of timing, since the steps were executed via some UI elements.

confusingstraw avatar May 30 '17 12:05 confusingstraw