Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Uncaught (in promise) Error: Unsupported URL: https://github.com/issues/ #372

Closed
SgtPooki opened this issue May 15, 2023 · 3 comments · Fixed by #373
Closed

bug: Uncaught (in promise) Error: Unsupported URL: https://github.com/issues/ #372

SgtPooki opened this issue May 15, 2023 · 3 comments · Fixed by #373
Assignees

Comments

@SgtPooki
Copy link
Contributor

reported in slack

problem url: https://starmap.site/roadmap/github.com/filecoin-station/roadmap/issues/1

paramsFromUrl.ts:17 Uncaught (in promise) Error: Unsupported URL: https://github.com/issues/
    at s (paramsFromUrl.ts:17:11)
    at [...slug].tsx:147:45
    at s (runtime.js:45:40)
    at Generator._invoke (runtime.js:274:22)
    at forEach.e.<computed> [as next] (runtime.js:97:21)
    at n (asyncToGenerator.js:3:20)
    at s (asyncToGenerator.js:25:9)
    at asyncToGenerator.js:32:7
    at new Promise (<anonymous>)
    at asyncToGenerator.js:21:12

image

source:

@SgtPooki
Copy link
Contributor Author

I attempted to load this URL, got a successfully rendered roadmap, and then refreshed and it succeeded again.

I removed my “debug” item in localStorage and reloaded, and got the same error as reported; investigating now.

@SgtPooki SgtPooki self-assigned this May 15, 2023
@SgtPooki
Copy link
Contributor Author

it seems like the children of CheckerNetwork/roadmap#12 are not being recognized properly.

@SgtPooki
Copy link
Contributor Author

The children parsing logic was failing on parsing a linePiece that was equal to ### due to:

export function getValidUrlFromInput(urlString: string): URL {
if (urlString.includes('#')) {
urlString = urlString.replace('#', '/issues/')
} else if (!urlString.includes('issues')) {
throw new Error('Unsupported URL string. URLs should be formatted like a github issue')
}
/**
* Cannot construct a URL from the given string.
*/
if (urlString.includes('http')) {
try {
return new URL(urlString)
} catch {}
}
if (urlString.includes('github.com')) {
try {
return new URL(`https://${urlString}`)
} catch {}
}
return new URL(urlString, 'https://github.com')
};

returning https://github.com/issues/## when called by

getValidUrlFromInput(linePiece.replace(/pull/g, 'issues'))

SgtPooki added a commit that referenced this issue May 16, 2023
SgtPooki added a commit that referenced this issue May 16, 2023
@SgtPooki SgtPooki linked a pull request May 16, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this to Needs Grooming in IPFS-GUI (PL EngRes) May 16, 2023
SgtPooki added a commit that referenced this issue May 16, 2023
* test: add test for #372

* fix: check for #<num> in getValidUrlFromInput

fixes #372

* chore: test fixture eof newline

Co-authored-by: Nishant Arora <[email protected]>

---------

Co-authored-by: Nishant Arora <[email protected]>
@github-project-automation github-project-automation bot moved this from Needs Grooming to Done in IPFS-GUI (PL EngRes) May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant