BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5bf22c86
Commit
5bf22c86
authored
Aug 11, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shared getFileExtension helper method
Fix
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12198#note_37146854
parent
fd8388d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+5
-1
repo_service.js
app/assets/javascripts/repo/services/repo_service.js
+2
-1
No files found.
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
5bf22c86
...
...
@@ -33,12 +33,16 @@ const RepoHelper = {
?
window
.
performance
:
Date
,
getFileExtension
(
fileName
)
{
return
fileName
.
split
(
'.'
).
pop
();
},
getBranch
()
{
return
$
(
'button.dropdown-menu-toggle'
).
attr
(
'data-ref'
);
},
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'
;
...
...
app/assets/javascripts/repo/services/repo_service.js
View file @
5bf22c86
...
...
@@ -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
:
''
,
...
...
@@ -37,7 +38,7 @@ const RepoService = {
},
urlIsRichBlob
(
url
=
this
.
url
)
{
const
extension
=
url
.
split
(
'.'
).
pop
(
);
const
extension
=
Helper
.
getFileExtension
(
url
);
return
this
.
richExtensionRegExp
.
test
(
extension
);
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment