`glab repo create` SIGSEGV when arg ends with slash

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: glab version 1.24.1 (2022-12-30)
  • Operating System and version: Debian Linux, self-compiled glab

Summary

When you run glab repo create and the name you give ends with a slash, the command ends with a SIGSEGV

Steps to reproduce

Attempt to create a repository that ends with a slash in the name. For example: repo-with-slash/.

What is the current bug behavior?

SIGSEGV with backtrace.

What is the expected correct behavior?

No SIGSEGV, maybe even an error.

Relevant logs and/or screenshots

$ glab repo create repo-with-slash/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xd12b60]

goroutine 1 [running]:
gitlab.com/gitlab-org/cli/commands/project/create.projectPathFromArgs({0xc0004c6660?, 0x0?, 0xb?})
        gitlab.com/gitlab-org/cli/commands/project/create/project_create.go:261 +0x80
gitlab.com/gitlab-org/cli/commands/project/create.runCreateProject(0x5ed600?, {0xc0004c6660, 0x1, 0x1}, 0xc00009e810)
        gitlab.com/gitlab-org/cli/commands/project/create/project_create.go:91 +0x17f
gitlab.com/gitlab-org/cli/commands/project/create.NewCmdCreate.func1(0xc000555400?, {0xc0004c6660?, 0x1?, 0x1?})
        gitlab.com/gitlab-org/cli/commands/project/create/project_create.go:30 +0x25
github.com/spf13/cobra.(*Command).execute(0xc000555400, {0xc0004c6640, 0x1, 0x1})
        github.com/spf13/cobra@v1.2.1/command.go:856 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004bca00)
        github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bd
main.main()
        gitlab.com/gitlab-org/cli/cmd/glab/main.go:147 +0x905

Possible fixes

This is where the stacktrace points, fwiw.

Assignee Loading
Time tracking Loading