File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default class GitHelper {
1818 / (?< domain > [ ^ \s \/ \? # : ] + ) / ,
1919 / (?: : (?< port > [ 0 - 9 ] { 1 , 5 } ) ) ? / ,
2020 / (?: [ \/ : ] (?< owner > [ ^ \s \/ \? # : ] + ) ) ? / ,
21- / (?: [ \/ : ] (?< repo > [ ^ \s \/ \? # : . ] + ) ) / ,
21+ / (?: [ \/ : ] (?< repo > (?: [ ^ \s \/ \? # : . ] | \. (? ! g i t \/ ? \s * $ ) ) + ) ) / ,
2222 / (?: .g i t ) ? \/ ? \s * $ / ,
2323 ]
2424 . map ( ( r ) => r . source )
Original file line number Diff line number Diff line change @@ -48,6 +48,40 @@ test('Testing - sanitizeRepoPathSsh from HTTPS', () => {
4848 ) . toBe ( 'ssh://git@github.com:22/username/repository.git' )
4949} )
5050
51+ test ( 'Testing - sanitizeRepoPathSsh - name with dot' , ( ) => {
52+ expect (
53+ GitHelper . sanitizeRepoPathSsh ( ' github.com/owner/site.com ' ) . repoPath
54+ ) . toBe ( 'ssh://git@github.com:22/owner/site.com.git' )
55+ } )
56+
57+ test ( 'Testing - sanitizeRepoPathSsh - name with dot and git suffix' , ( ) => {
58+ expect (
59+ GitHelper . sanitizeRepoPathSsh ( ' github.com/owner/site.com.git ' )
60+ . repoPath
61+ ) . toBe ( 'ssh://git@github.com:22/owner/site.com.git' )
62+ } )
63+
64+ test ( 'Testing - sanitizeRepoPathSsh - name containing ".git"' , ( ) => {
65+ expect (
66+ GitHelper . sanitizeRepoPathSsh ( ' github.com/owner/repo.github ' )
67+ . repoPath
68+ ) . toBe ( 'ssh://git@github.com:22/owner/repo.github.git' )
69+ } )
70+
71+ test ( 'Testing - sanitizeRepoPathSsh - name containing ".git" and git suffix' , ( ) => {
72+ expect (
73+ GitHelper . sanitizeRepoPathSsh ( ' github.com/owner/repo.github.git ' )
74+ . repoPath
75+ ) . toBe ( 'ssh://git@github.com:22/owner/repo.github.git' )
76+ } )
77+
78+ test ( 'Testing - sanitizeRepoPathSsh - name containing ".git", git suffix and /' , ( ) => {
79+ expect (
80+ GitHelper . sanitizeRepoPathSsh ( ' github.com/owner/repo.github.git/ ' )
81+ . repoPath
82+ ) . toBe ( 'ssh://git@github.com:22/owner/repo.github.git' )
83+ } )
84+
5185test ( 'Testing - sanitizeRepoPathSsh - not git suffix' , ( ) => {
5286 expect (
5387 GitHelper . sanitizeRepoPathSsh ( ' github.com/owner/repository ' ) . repoPath
You can’t perform that action at this time.
0 commit comments