From 879d26ea8fd93446d74c6fc65ac5480c6eb934a4 Mon Sep 17 00:00:00 2001 From: Madara Uchiha Date: Sat, 20 Jul 2019 19:52:07 +0300 Subject: [PATCH] Don't prevent default before you're sure there's a file. Fixes #14. --- src/modules/BetterImageUploadsModule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/BetterImageUploadsModule.ts b/src/modules/BetterImageUploadsModule.ts index 1178230..2dc6f3f 100644 --- a/src/modules/BetterImageUploadsModule.ts +++ b/src/modules/BetterImageUploadsModule.ts @@ -113,12 +113,12 @@ export class BetterImageUploadsModule { } private async handleDrop(e: DragEvent) { - e.preventDefault(); const file = this.extractFile(() => e.dataTransfer!); if (!file) { return; } + e.preventDefault(); const url = await this.uploadFile(file); this.appendToInput(url);