Commit 9772fa8e authored by Eric Eastwood's avatar Eric Eastwood

Add shared getFileExtension helper method

Fix
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12198#note_37146854

Conflicts:
	app/assets/javascripts/repo/helpers/repo_helper.js
parent 7cfdc62d
......@@ -40,7 +40,7 @@ const RepoHelper = {
},
getLanguageIDForFile(file, langs) {
const ext = file.name.split('.').pop();
const ext = RepoHelper.getFileExtension(file.name);
const foundLang = RepoHelper.findLanguage(ext, langs);
return foundLang ? foundLang.id : 'plaintext';
......
......@@ -2,6 +2,7 @@
import axios from 'axios';
import Store from '../stores/repo_store';
import Api from '../../api';
import Helper from '../helpers/repo_helper';
const RepoService = {
url: '',
......@@ -29,7 +30,7 @@ const RepoService = {
},
urlIsRichBlob(url = this.url) {
const extension = url.split('.').pop();
const extension = Helper.getFileExtension(url);
return this.richExtensionRegExp.test(extension);
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment