Skip to content
This repository has been archived by the owner on Dec 20, 2017. It is now read-only.

Windows path causing regex exception #254

Open
jadedfire opened this issue Jan 5, 2016 · 3 comments
Open

Windows path causing regex exception #254

jadedfire opened this issue Jan 5, 2016 · 3 comments
Labels

Comments

@jadedfire
Copy link

The Windows path separator is not being escaped, and results in an invalid escape sequence. The below is for the basic auth node module, but this occurs on all .md files regardless of what it is due to the path.

java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 4
^C:\Users\[USERNAME]\[PATH TO PROJECTS]\[PROJECT NAME]/(?:\Qnode_modules/basic-auth/LICENSE\E)$
    ^
    at java.util.regex.Pattern.error(Pattern.java:1955)
    at java.util.regex.Pattern.escape(Pattern.java:2471)
    at java.util.regex.Pattern.atom(Pattern.java:2198)
    at java.util.regex.Pattern.sequence(Pattern.java:2130)
    at java.util.regex.Pattern.expr(Pattern.java:1996)
    at java.util.regex.Pattern.compile(Pattern.java:1696)
    at java.util.regex.Pattern.<init>(Pattern.java:1351)
    at java.util.regex.Pattern.compile(Pattern.java:1028)
    at kotlin.text.Regex.<init>(RegexJVM.kt:98)
    at kotlin.text.StringsKt__RegexExtensionsKt.toRegex(RegexExtensions.kt:9)
    at kotlin.text.StringsKt.toRegex(Unknown Source)
    at com.vladsch.idea.multimarkdown.util.GitHubLinkResolver.getMatchedRefs(GitHubLinkResolver.kt:247)
    at com.vladsch.idea.multimarkdown.util.GitHubLinkResolver.resolve(GitHubLinkResolver.kt:157)
    at com.vladsch.idea.multimarkdown.editor.MultiMarkdownLinkRenderer.getLinkTarget(MultiMarkdownLinkRenderer.java:78)
    at com.vladsch.idea.multimarkdown.editor.MultiMarkdownLinkRenderer.renderLink(MultiMarkdownLinkRenderer.java:102)
    at com.vladsch.idea.multimarkdown.editor.MultiMarkdownLinkRenderer.render(MultiMarkdownLinkRenderer.java:128)
    at org.pegdown.ToHtmlSerializer.visit(ToHtmlSerializer.java:215)
    at org.pegdown.ast.ExpLinkNode.accept(ExpLinkNode.java:35)
    at org.pegdown.ToHtmlSerializer.visitChildrenSkipFirst(ToHtmlSerializer.java:606)
    at org.pegdown.ToHtmlSerializer.visitChildren(ToHtmlSerializer.java:594)
    at org.pegdown.ToHtmlSerializer.visit(ToHtmlSerializer.java:579)
    at org.pegdown.ast.SuperNode.accept(SuperNode.java:43)
    at org.pegdown.ToHtmlSerializer.visitChildrenSkipFirst(ToHtmlSerializer.java:606)
    at org.pegdown.ToHtmlSerializer.visitChildren(ToHtmlSerializer.java:594)
    at org.pegdown.ToHtmlSerializer.printTag(ToHtmlSerializer.java:620)
    at org.pegdown.ToHtmlSerializer.printBreakBeforeTag(ToHtmlSerializer.java:627)
    at org.pegdown.ToHtmlSerializer.visit(ToHtmlSerializer.java:315)
    at org.pegdown.ast.ParaNode.accept(ParaNode.java:35)
    at org.pegdown.ToHtmlSerializer.visitChildrenSkipFirst(ToHtmlSerializer.java:606)
    at org.pegdown.ToHtmlSerializer.visitChildren(ToHtmlSerializer.java:594)
    at org.pegdown.ToHtmlSerializer.visit(ToHtmlSerializer.java:120)
    at org.pegdown.ast.RootNode.accept(RootNode.java:96)
    at org.pegdown.ToHtmlSerializer.toHtml(ToHtmlSerializer.java:90)
    at com.vladsch.idea.multimarkdown.editor.resources.JavaFxHtmlGenerator.toHtml(JavaFxHtmlGenerator.kt:54)
    at com.vladsch.idea.multimarkdown.editor.MarkdownPreviewFileEditor$HtmlUpdater.run(MarkdownPreviewFileEditor.kt:272)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:702)
    at java.awt.EventQueue$3.run(EventQueue.java:696)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:734)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
@vsch
Copy link

vsch commented Jan 5, 2016

@jadedfire, thanks for reporting it. I opened an issue vsch/idea-multimarkdown#131. This repo is of the original idea-markdown plugin. I will post a quick fix version and let you know when the fix is available.

@vsch
Copy link

vsch commented Jan 5, 2016

@jadedfire, quick fix build 1.4.0.1 available. Fixes exception in regex and also improper URI's were generated for local files due to windows platform idiosyncrasies. Now local images and local only file links resolve in preview.

Thank you for reporting this issue. It was a potential bug on other platforms and a killer on Windows.

Download and install plugin from disk: https://github.com/vsch/idea-multimarkdown/raw/master/dist/idea-multimarkdown.1.4.0.1.zip

@nicoulaj nicoulaj added the Bug label May 22, 2016
@nicoulaj
Copy link
Owner

Notice: This plugin is no more maintained and it has been removed from Jetbrains plugins repository. There is a Markdown plugin officially supported by Jetbrains.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants