Skip to content

Commit 0c7f3da

Browse files
authored
Merge pull request #1279 from Cycloctane/fix_license_suggestion
Fix repository url parser in LicenseSuggestion
2 parents 8b4b880 + fee0d8e commit 0c7f3da

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

assets/js/app.coffee

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,9 @@ class LicenseSuggestion
112112

113113
# Try to extract the repository full name from the user input
114114
parseUserInput: (userInput) ->
115-
repository = /https?:\/\/github\.com\/(.*?)\/(.+)(\.git)?$/.exec userInput
115+
repository = /https?:\/\/github\.com\/([^\/]+)\/([^\/\?#]+)/.exec userInput
116116
[_, username, project] = repository
117-
project = project
118-
.split /\/|\.git/
119-
.filter (str) -> str
120-
.slice 0, 1
121-
.join ""
122-
return username + '/' + project
117+
return username + '/' + project.replace /(\.git)$/, ''
123118

124119
# Displays an indicator and tooltips to the user about the current status
125120
setStatus: (status="", message="") =>

0 commit comments

Comments
 (0)