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

Including '%' generates invalid memory address or nil pointer dereference #245

Open
brendan-stephens opened this issue Mar 28, 2024 · 0 comments

Comments

@brendan-stephens
Copy link

restish --version
restish version 0.20.0

The api function here takes a SQL search pattern, where % is a wildcard.
This causes a null pointer error.

restish api search '%@domain.com' -v
DEBUG: API loading took 10.817125ms
DEBUG: Configuration: map[api-name:api app-name:restish 
...
rsh-filter: rsh-header:[] rsh-ignore-status-code:false rsh-insecure:false rsh-no-cache:false rsh-no-paginate:false rsh-output-format:auto rsh-profile:default rsh-query:[] rsh-raw:false rsh-retry:2 rsh-server: rsh-timeout:0s rsh-verbose:true server-index:0 tty:true]

ERROR: Caught error: runtime error: invalid memory address or nil pointer dereference
DEBUG: goroutine 1 [running]:
runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.18.10/x64/src/runtime/debug/stack.go:24 +0x68
github.com/danielgtaylor/restish/cli.Run.func1()
	/home/runner/work/restish/restish/cli/cli.go:849 +0x68
panic({0x105ce3fc0, 0x106472320})
	/opt/hostedtoolcache/go/1.18.10/x64/src/runtime/panic.go:838 +0x204
github.com/danielgtaylor/restish/cli.Operation.command.func1(0x140000c9b00?, {0x14000392da0, 0x1, 0x2})
	/home/runner/work/restish/restish/cli/operation.go:141 +0x7e4
github.com/spf13/cobra.(*Command).execute(0x140000c9b00, {0x14000392d80, 0x2, 0x2})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:920 +0x5dc
github.com/spf13/cobra.(*Command).ExecuteC(0x1400034a600)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/danielgtaylor/restish/cli.Run()
	/home/runner/work/restish/restish/cli/cli.go:857 +0x9a8
main.main()
	/home/runner/work/restish/restish/main.go:40 +0x370

Configuration:

{
  "\$schema": "https://rest.sh/schemas/apis.json",
  "admin-api": {
    "base": "https://api.com/v1",
    "profiles": {
      "default": {
        "headers": {
          "Authorization": $ACCESS_TOKEN"
        }
      }
    },
    "tls": {}
  }
}
@brendan-stephens brendan-stephens changed the title Including '%' generates a null pointer error Including '%' generates invalid memory address or nil pointer dereference Mar 28, 2024
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

No branches or pull requests

1 participant