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

Invalid web-url crashes frontend #102

Open
KonradStanski opened this issue Dec 1, 2024 · 0 comments
Open

Invalid web-url crashes frontend #102

KonradStanski opened this issue Dec 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@KonradStanski
Copy link
Contributor

KonradStanski commented Dec 1, 2024

export const getRepoCodeHostInfo = (repo?: Repository): CodeHostInfo | undefined => {
    if (!repo) {
        return undefined;
    }

    const hostType = repo.RawConfig ? repo.RawConfig['web-url-type'] : undefined;
    if (!hostType) {
        return undefined;
    }

    const url = new URL(repo.URL);
    const displayName = url.pathname.slice(1);

If a host provides an invalid web-url and the new URL(repo.URL); fails, this crashes the page. I think we should catch this and not provide a link if it is null.

@brendan-kellam brendan-kellam added the bug Something isn't working label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants