mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-189291 [markdown] Handle InvalidPathException
GitOrigin-RevId: 8e27c826ebd9effae7e12e59e7d27d6474e441b7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b63bbd7d7c
commit
0a369840d6
+5
-2
@@ -27,6 +27,7 @@ import org.intellij.plugins.markdown.service.MarkdownLinkOpenerRemoteApi
|
||||
import java.io.IOException
|
||||
import java.net.URI
|
||||
import java.net.URISyntaxException
|
||||
import java.nio.file.InvalidPathException
|
||||
import java.nio.file.Path
|
||||
|
||||
internal class MarkdownLinkOpenerRemoteApiImpl : MarkdownLinkOpenerRemoteApi {
|
||||
@@ -96,13 +97,15 @@ internal class MarkdownLinkOpenerRemoteApiImpl : MarkdownLinkOpenerRemoteApi {
|
||||
}
|
||||
}
|
||||
val containingFile = virtualFileId?.virtualFile()?.parent ?: return null
|
||||
val targetFile = try {
|
||||
return try {
|
||||
containingFile.findFile(link.trimAnchor())
|
||||
}
|
||||
catch (_: IOException) {
|
||||
null
|
||||
}
|
||||
return targetFile
|
||||
catch (_: InvalidPathException) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun collectHeaders(anchor: String, targetFile: VirtualFile, project: Project): List<MarkdownHeaderInfo>? {
|
||||
|
||||
Reference in New Issue
Block a user