Browse Source

fix: omit port in clone ~> readme url conversion

as the https port will be different than that used by git

fix nostr:nevent1qqsv7mqkleadz5jzd63rygnne73ugh02wxuuq8evzcmlult4658dulspp4mhxue69uhkummn9ekx7mqzypl62m6ad932k83u6sjwwkxrqq4cve0hkrvdem5la83g34m4rtqeggv37pm
master
DanConwayDev 2 years ago
parent
commit
d3cfce5036
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. 8
      src/lib/components/repo/utils.spec.ts
  2. 1
      src/lib/components/repo/utils.ts

8
src/lib/components/repo/utils.spec.ts

@ -239,6 +239,14 @@ describe('cloneArrayToReadMeUrls', () => { @@ -239,6 +239,14 @@ describe('cloneArrayToReadMeUrls', () => {
'https://codeberg.org/orgname/reponame/raw/HEAD/readme.md',
])
})
test('strips port eg ssh://git@git.v0l.io:2222/Kieran/snort.git to address', () => {
expect(
cloneArrayToReadMeUrls(['ssh://git@git.v0l.io:2222/Kieran/snort.git'])
).toEqual([
'https://git.v0l.io/Kieran/snort/raw/HEAD/README.md',
'https://git.v0l.io/Kieran/snort/raw/HEAD/readme.md',
])
})
test('https://custom.com/deep/deeper/deeper to address', () => {
expect(
cloneArrayToReadMeUrls(['https://custom.com/deep/deeper/deeper'])

1
src/lib/components/repo/utils.ts

@ -66,6 +66,7 @@ const extractRepoAddress = (clone_string: string): string => { @@ -66,6 +66,7 @@ const extractRepoAddress = (clone_string: string): string => {
// remove @ and anything before
if (s.includes('@')) s = s.split('@')[1]
// replace : with /
s = s.replace(/\s|:[0-9]+/g, '')
s = s.replace(':', '/')
return s
}

Loading…
Cancel
Save