| Index: ui/file_manager/file_manager/background/js/media_import_handler.js
|
| diff --git a/ui/file_manager/file_manager/background/js/media_import_handler.js b/ui/file_manager/file_manager/background/js/media_import_handler.js
|
| index a796cf5034723b492522690d61d4437b372a999c..6b04b756de7c97cd09632c3b5b00c239999a6df1 100644
|
| --- a/ui/file_manager/file_manager/background/js/media_import_handler.js
|
| +++ b/ui/file_manager/file_manager/background/js/media_import_handler.js
|
| @@ -317,8 +317,9 @@ importer.MediaImportHandler.ImportTask.prototype.importOne_ =
|
| /**
|
| * @param {!FileEntry} entry The file to copy.
|
| * @param {!DirectoryEntry} destinationDirectory The destination directory.
|
| - * @return {!Promise<!FileEntry>} Resolves to the destination file when the copy
|
| - * is complete.
|
| + * @return {!Promise<FileEntry>} Resolves to the destination file when the copy
|
| + * is complete. The FileEntry may be null if the import was cancelled. The
|
| + * promise will reject if an error occurs.
|
| * @private
|
| */
|
| importer.MediaImportHandler.ImportTask.prototype.copy_ =
|
| @@ -375,13 +376,20 @@ importer.MediaImportHandler.ImportTask.prototype.copy_ =
|
| /** @this {importer.MediaImportHandler.ImportTask} */
|
| var onError = function(error) {
|
| this.cancelCallback_ = null;
|
| - this.errorCount_++;
|
| // Log the bytes as processed in spite of the error. This ensures
|
| // completion of the progress bar.
|
| this.processedBytes_ -= currentBytes;
|
| this.processedBytes_ += entry.size;
|
| - this.notify(importer.TaskQueue.UpdateType.ERROR);
|
| - resolver.reject(error);
|
| + if (error.name === util.FileError.ABORT_ERR) {
|
| + // Task cancellations result in the error callback being triggered with an
|
| + // ABORT_ERR, but we want to ignore these errors.
|
| + this.notify(importer.TaskQueue.UpdateType.PROGRESS);
|
| + resolver.resolve(null);
|
| + } else {
|
| + this.errorCount_++;
|
| + this.notify(importer.TaskQueue.UpdateType.ERROR);
|
| + resolver.reject(error);
|
| + }
|
| };
|
|
|
| fileOperationUtil.deduplicatePath(destinationDirectory, entry.name)
|
|
|