summaryrefslogtreecommitdiffstats
path: root/webapp/utils/syntax_hightlighting.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils/syntax_hightlighting.jsx')
-rw-r--r--webapp/utils/syntax_hightlighting.jsx10
1 files changed, 4 insertions, 6 deletions
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;
}