Przeglądaj źródła

don't call onProgress when upload is cancelled

Former-commit-id: 7cce063b7b990ecfba9f1f02df09d625ddebbd25
Gildas 6 lat temu
rodzic
commit
6bd24b9041
1 zmienionych plików z 2 dodań i 2 usunięć
  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");
 			this.url = location;
-			if (this.onProgress) {
+			if (this.onProgress && !this.cancelled) {
 				this.onProgress(0, this.file.size);
 			}
 			return sendFile(this);
@@ -345,7 +345,7 @@ this.GDrive = this.GDrive || (() => {
 			},
 			body: content
 		});
-		if (mediaUploader.onProgress) {
+		if (mediaUploader.onProgress && !mediaUploader.cancelled) {
 			mediaUploader.onProgress(mediaUploader.offset + mediaUploader.chunkSize, mediaUploader.file.size);
 		}
 		if (httpResponse.status == 200 || httpResponse.status == 201) {