Просмотр исходного кода

don't call onProgress when upload is cancelled

Former-commit-id: 7cce063b7b990ecfba9f1f02df09d625ddebbd25
Gildas 6 лет назад
Родитель
Сommit
6bd24b9041
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      extension/lib/gdrive/gdrive.js

+ 2 - 2
extension/lib/gdrive/gdrive.js

@@ -180,7 +180,7 @@ this.GDrive = this.GDrive || (() => {
 			}));
 			}));
 			const location = httpResponse.headers.get("Location");
 			const location = httpResponse.headers.get("Location");
 			this.url = location;
 			this.url = location;
-			if (this.onProgress) {
+			if (this.onProgress && !this.cancelled) {
 				this.onProgress(0, this.file.size);
 				this.onProgress(0, this.file.size);
 			}
 			}
 			return sendFile(this);
 			return sendFile(this);
@@ -345,7 +345,7 @@ this.GDrive = this.GDrive || (() => {
 			},
 			},
 			body: content
 			body: content
 		});
 		});
-		if (mediaUploader.onProgress) {
+		if (mediaUploader.onProgress && !mediaUploader.cancelled) {
 			mediaUploader.onProgress(mediaUploader.offset + mediaUploader.chunkSize, mediaUploader.file.size);
 			mediaUploader.onProgress(mediaUploader.offset + mediaUploader.chunkSize, mediaUploader.file.size);
 		}
 		}
 		if (httpResponse.status == 200 || httpResponse.status == 201) {
 		if (httpResponse.status == 200 || httpResponse.status == 201) {