Links check: fix for prefix check (#10786)

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
Adam R 2021-06-26 22:02:27 +02:00 committed by GitHub
parent 22ac0dd69d
commit 6a5dfc94b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@
}, },
{ {
"name": "facebook", "name": "facebook",
"url": "https://www.facebook.com/parsiqnet/" "url": "https://facebook.com/parsiqnet/"
}, },
{ {
"name": "medium", "name": "medium",

View File

@ -37,7 +37,7 @@
}, },
{ {
"name": "facebook", "name": "facebook",
"url": "https://www.facebook.com/parsiqnet/" "url": "https://facebook.com/parsiqnet/"
}, },
{ {
"name": "medium", "name": "medium",

View File

@ -28,7 +28,7 @@ const linksKeys = {
"telegram_news": "https://t.me/", // read-only announcement channel "telegram_news": "https://t.me/", // read-only announcement channel
"medium": "", // url contains 'medium.com' "medium": "", // url contains 'medium.com'
"discord": "https://discord.com/", "discord": "https://discord.com/",
"reddit": "https://redditX.com/", "reddit": "https://reddit.com/",
"facebook": "https://facebook.com/", "facebook": "https://facebook.com/",
"youtube": "https://youtube.com/", "youtube": "https://youtube.com/",
"coinmarketcap": "https://coinmarketcap.com/", "coinmarketcap": "https://coinmarketcap.com/",
@ -159,7 +159,7 @@ function isInfoLinksValid(links: unknown, path: string, address: string, chain:
if (!Object.prototype.hasOwnProperty.call(linksKeys, fname)) { if (!Object.prototype.hasOwnProperty.call(linksKeys, fname)) {
return [`Not supported field in links '${fname}'. Supported keys: ${linksKeysString}`, ""]; return [`Not supported field in links '${fname}'. Supported keys: ${linksKeysString}`, ""];
} }
const prefix = linksKeys[f]; const prefix = linksKeys[fname];
if (prefix) { if (prefix) {
if (!furl.startsWith(prefix)) { if (!furl.startsWith(prefix)) {
return [`Links field '${fname}': '${furl}' must start with '${prefix}'. Supported keys: ${linksKeysString}`, ""]; return [`Links field '${fname}': '${furl}' must start with '${prefix}'. Supported keys: ${linksKeysString}`, ""];