Skip to content

Invalid web-url crashes frontend #102

Open
@KonradStanski

Description

@KonradStanski
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions