Limit drop disablement to just http(s) uris (#209240)

For #209239
This commit is contained in:
Matt Bierner
2024-04-01 04:37:06 -07:00
committed by GitHub
parent dcfb696a4b
commit 7d788e70b9
2 changed files with 7 additions and 3 deletions

View File

@@ -156,9 +156,14 @@ class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, v
return;
}
// Disable ourselves if there's also a text entry with the same content as our list,
// In some browsers, copying from the address bar sets both text/uri-list and text/plain.
// Disable ourselves if there's also a text entry with the same http(s) uri as our list,
// unless we are explicitly requested.
if (uriList.entries.length === 1 && !context?.only?.contains(ResourcePasteOrDropProvider.kind)) {
if (
uriList.entries.length === 1
&& (uriList.entries[0].uri.scheme === Schemes.http || uriList.entries[0].uri.scheme === Schemes.https)
&& !context?.only?.contains(ResourcePasteOrDropProvider.kind)
) {
const text = await dataTransfer.get(Mime.textPlain)?.asString();
if (token.isCancellationRequested) {
return;

View File

@@ -74,7 +74,6 @@ export function createInsertUriListEdit(
return;
}
const edits: vscode.SnippetTextEdit[] = [];
let insertedLinkCount = 0;