From 167dd22eefeeeb9c1eaebd990a4f5902bd366302 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Mon, 29 Aug 2016 09:50:00 -0400
Subject: PLT-1752/PLT-3567/PLT-3998 Highlighting links in search, unit tests
 for autolinking (#3865)

* Added highlighting to links when their URL includes the search term

* Decoupling UserStore from react-router to allow for unit tests involving it

* PLT-3998 Added SiteURL as an option to be passed into the text formatting code

* Removed reference to PreferenceStore and window from TextFormatting

* Refactored TextFormatting to remove remaining browser-only code

* Updated ChannelHeader and MessageWrapper to match the changes to TextFormatting

* Increased max listeners for Preference and Emoji stores

* PLT-3832 Added automated unit tests for autolinking

* PLT-3567 Rerender posts when mention keywords change

* Updated RHS and search to match the changes to TextFormatting

* Broke TextFormatting's dependency on the UserStore
---
 webapp/utils/syntax_hightlighting.jsx | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'webapp/utils/syntax_hightlighting.jsx')

diff --git a/webapp/utils/syntax_hightlighting.jsx b/webapp/utils/syntax_hightlighting.jsx
index ce904c41f..4146c43c5 100644
--- a/webapp/utils/syntax_hightlighting.jsx
+++ b/webapp/utils/syntax_hightlighting.jsx
@@ -1,7 +1,6 @@
 // Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
 // See License.txt for license information.
 
-import * as Utils from './utils.jsx';
 import * as TextFormatting from './text_formatting.jsx';
 import Constants from './constants.jsx';
 
@@ -138,18 +137,17 @@ export function highlight(lang, code) {
 }
 
 export function getLanguageFromFilename(filename) {
-    const fileInfo = Utils.splitFileLocation(filename);
-    var ext = fileInfo.ext;
-    if (!ext) {
-        return null;
-    }
+    const fileSplit = filename.split('.');
 
+    let ext = fileSplit.length > 1 ? fileSplit[fileSplit.length - 1] : '';
     ext = ext.toLowerCase();
+
     for (var key in HighlightedLanguages) {
         if (HighlightedLanguages[key].extensions.find((x) => x === ext)) {
             return key;
         }
     }
+
     return null;
 }
 
-- 
cgit v1.2.3-1-g7c22

