Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/url: skip drag/dropped local files #5626

Merged
merged 1 commit into from
Feb 3, 2025
Merged

@uppy/url: skip drag/dropped local files #5626

merged 1 commit into from
Feb 3, 2025

Conversation

Murderlon
Copy link
Member

Closes #5622

@Murderlon Murderlon self-assigned this Jan 27, 2025
Copy link
Contributor

Diff output files
diff --git a/packages/@uppy/url/lib/Url.js b/packages/@uppy/url/lib/Url.js
index e1045fc..8fe4623 100644
--- a/packages/@uppy/url/lib/Url.js
+++ b/packages/@uppy/url/lib/Url.js
@@ -57,12 +57,16 @@ export default class Url extends UIPlugin {
       });
     };
     this.addFile = async (protocollessUrl, optionalMeta) => {
+      if (protocollessUrl.startsWith("blob")) {
+        return undefined;
+      }
       const url = addProtocolToURL(protocollessUrl);
       if (!checkIfCorrectURL(url)) {
         this.uppy.log(`[URL] Incorrect URL entered: ${url}`);
         this.uppy.info(this.i18n("enterCorrectUrl"), "error", 4000);
         return undefined;
       }
+      this.uppy.log(`[URL] Adding file from dropped/pasted url: ${url}`);
       try {
         const meta = await this.getMeta(url);
         const tagFile = {
@@ -111,13 +115,11 @@ export default class Url extends UIPlugin {
     };
     this.handleRootDrop = e => {
       forEachDroppedOrPastedUrl(e.dataTransfer, "drop", url => {
-        this.uppy.log(`[URL] Adding file from dropped url: ${url}`);
         this.addFile(url);
       });
     };
     this.handleRootPaste = e => {
       forEachDroppedOrPastedUrl(e.clipboardData, "paste", url => {
-        this.uppy.log(`[URL] Adding file from pasted url: ${url}`);
         this.addFile(url);
       });
     };

@Murderlon Murderlon merged commit 3efe61b into main Feb 3, 2025
16 checks passed
@Murderlon Murderlon deleted the url-local-files branch February 3, 2025 12:39
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
github-actions bot added a commit that referenced this pull request Feb 3, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/core                 |   4.4.2 | @uppy/provider-views       |   4.4.2 |
| @uppy/google-drive-picker  |   0.3.3 | @uppy/url                  |   4.2.2 |
| @uppy/google-photos-picker |   0.3.3 | @uppy/utils                |   6.1.2 |
| @uppy/locales              |   4.5.1 | uppy                       |  4.13.2 |

- @uppy/utils: do not strip www in getSocketHost (Merlijn Vos / #5621)
- @uppy/url: skip drag/dropped local files (Merlijn Vos / #5626)
- @uppy/provider-views: fix google photos picker videos (Mikael Finstad / #5635)
- @uppy/core,@uppy/google-drive-picker,@uppy/google-photos-picker,@uppy/provider-views:
  fix google picker i18n (Mikael Finstad / #5632)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dragging already added file and dropping it, duplicates file
1 participant