Skip to content

Commit 3efe61b

Browse files
authored
@uppy/url: skip drag/dropped local files (#5626)
1 parent ff47668 commit 3efe61b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/@uppy/url/src/Url.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,19 @@ export default class Url<M extends Meta, B extends Body> extends UIPlugin<
129129
protocollessUrl: string,
130130
optionalMeta?: M,
131131
): Promise<string | undefined> => {
132+
// Do not process local files
133+
if (protocollessUrl.startsWith('blob')) {
134+
return undefined
135+
}
132136
const url = addProtocolToURL(protocollessUrl)
133137
if (!checkIfCorrectURL(url)) {
134138
this.uppy.log(`[URL] Incorrect URL entered: ${url}`)
135139
this.uppy.info(this.i18n('enterCorrectUrl'), 'error', 4000)
136140
return undefined
137141
}
138142

143+
this.uppy.log(`[URL] Adding file from dropped/pasted url: ${url}`)
144+
139145
try {
140146
const meta = await this.getMeta(url)
141147

@@ -187,14 +193,12 @@ export default class Url<M extends Meta, B extends Body> extends UIPlugin<
187193

188194
private handleRootDrop = (e: DragEvent) => {
189195
forEachDroppedOrPastedUrl(e.dataTransfer!, 'drop', (url) => {
190-
this.uppy.log(`[URL] Adding file from dropped url: ${url}`)
191196
this.addFile(url)
192197
})
193198
}
194199

195200
private handleRootPaste = (e: ClipboardEvent) => {
196201
forEachDroppedOrPastedUrl(e.clipboardData!, 'paste', (url) => {
197-
this.uppy.log(`[URL] Adding file from pasted url: ${url}`)
198202
this.addFile(url)
199203
})
200204
}

0 commit comments

Comments
 (0)