Skip to content

Commit

Permalink
We do not need to be so strict on file names as we have checked PREFIX.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCoder committed Sep 21, 2022
1 parent 36491ad commit 013f361
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.*;
import org.intellij.plugins.markdown.settings.MarkdownCssSettings;
import org.intellij.plugins.markdown.ui.preview.javafx.MarkdownJavaFxHtmlPanel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -29,7 +30,7 @@
public class PreviewStaticServer2 extends HttpRequestHandler {
public static final String INLINE_CSS_FILENAME = "inline.css";
private static final Logger LOG = Logger.getInstance(PreviewStaticServer2.class);
private static final String PREFIX = "/api/markdown-preview/";
private static final String PREFIX = "/api/zenuml-preview/";

@Nullable
private byte[] myInlineStyleBytes = null;
Expand Down Expand Up @@ -88,19 +89,19 @@ public boolean process(@NotNull QueryStringDecoder urlDecoder,
final String contentType = typeAndName.get(0);
final String fileName = typeAndName.get(1);

if ("js".equals(contentType) && MarkdownHtmlPanel.SCRIPTS.contains(fileName)) {
if ("js".equals(contentType)) {
sendResource(request,
context.channel(),
MarkdownJavaFxHtmlPanel.class,
fileName);
} else if (("css".equals(contentType) || "styles".equals(contentType)) && MarkdownHtmlPanel.STYLES.contains(fileName)) {
} else if (("css".equals(contentType) || "styles".equals(contentType))) {

if (INLINE_CSS_FILENAME.equals(fileName)) {
sendInlineStyle(request, context.channel());
} else {
sendResource(request,
context.channel(),
MarkdownJavaFxHtmlPanel.class,
MarkdownCssSettings.class,
fileName);
}
} else {
Expand Down

0 comments on commit 013f361

Please sign in to comment.