Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 29adfe5

Browse filesBrowse files
committed
fix: backport regex fix from #76
PR-URL: #84 Credit: @nlf Close: #84 Reviewed-by: @wraithgar
1 parent afeaefd commit 29adfe5
Copy full SHA for 29adfe5

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎index.js

Copy file name to clipboardExpand all lines: index.js
+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function fromUrl (giturl, opts) {
4141
isGitHubShorthand(giturl) ? 'github:' + giturl : giturl
4242
)
4343
var parsed = parseGitUrl(url)
44-
var shortcutMatch = url.match(new RegExp('^([^:]+):(?:(?:[^@:]+(?:[^@]+)?@)?([^/]*))[/](.+?)(?:[.]git)?($|#)'))
44+
var shortcutMatch = url.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/)
4545
var matches = Object.keys(gitHosts).map(function (gitHostName) {
4646
try {
4747
var gitHostInfo = gitHosts[gitHostName]
@@ -55,7 +55,7 @@ function fromUrl (giturl, opts) {
5555
var defaultRepresentation = null
5656
if (shortcutMatch && shortcutMatch[1] === gitHostName) {
5757
user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2])
58-
project = decodeURIComponent(shortcutMatch[3])
58+
project = decodeURIComponent(shortcutMatch[3].replace(/\.git$/, ''))
5959
defaultRepresentation = 'shortcut'
6060
} else {
6161
if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, '') !== gitHostInfo.domain) return

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.