From 14dee8455f6d1166732ae89d51649ada19f5559b Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Thu, 20 Oct 2016 16:54:55 -0700 Subject: [PATCH] Added default fallback for 'Text only' if the syntax is not supported. --- Teknik/Areas/Paste/Controllers/PasteController.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Teknik/Areas/Paste/Controllers/PasteController.cs b/Teknik/Areas/Paste/Controllers/PasteController.cs index 3476a49..c39b872 100644 --- a/Teknik/Areas/Paste/Controllers/PasteController.cs +++ b/Teknik/Areas/Paste/Controllers/PasteController.cs @@ -103,10 +103,11 @@ namespace Teknik.Areas.Paste.Controllers // Transform content into HTML if (Highlighter.Lexers.ToList().Exists(l => l.Name == model.Syntax)) { - Highlighter highlighter = new Highlighter(); - // Add a space in front of the content due to bug with pygment (No idea why yet) - model.Content = highlighter.HighlightToHtml(" " + model.Content, model.Syntax, Config.PasteConfig.SyntaxVisualStyle, generateInlineStyles: true, fragment: true); + model.Syntax = "Text only"; } + Highlighter highlighter = new Highlighter(); + // Add a space in front of the content due to bug with pygment (No idea why yet) + model.Content = highlighter.HighlightToHtml(" " + model.Content, model.Syntax, Config.PasteConfig.SyntaxVisualStyle, generateInlineStyles: true, fragment: true); } switch (type.ToLower())