From cfc017c0a5ed2ab92af33c5fbd73096fd2a08a07 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Mon, 6 Nov 2023 14:28:24 +0100 Subject: [PATCH] fix: ignore non-local files in LSPDocumentationProvider#handleExternalLink Signed-off-by: Fred Bricon --- .../operations/documentation/LSPDocumentationProvider.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/documentation/LSPDocumentationProvider.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/documentation/LSPDocumentationProvider.java index 0d48905e0..6540f7ab3 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/documentation/LSPDocumentationProvider.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/documentation/LSPDocumentationProvider.java @@ -20,6 +20,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; +import com.intellij.util.io.URLUtil; import com.redhat.devtools.intellij.lsp4ij.LSPIJUtils; import com.redhat.devtools.intellij.lsp4ij.operations.completion.LSPCompletionProposal; import com.vladsch.flexmark.html.HtmlRenderer; @@ -146,6 +147,10 @@ public boolean handleExternal(PsiElement element, PsiElement originalElement) { @Override public boolean handleExternalLink(PsiManager psiManager, String link, PsiElement context) { + //Ignore non-local uri (http(s), mailto, ftp...) + if (URLUtil.URL_PATTERN.matcher(link).matches()) { + return false; + } VirtualFile file = LSPIJUtils.findResourceFor(link); if (file != null) { FileEditorManager.getInstance(psiManager.getProject()).openFile(file, true, true);