shell-operator icon indicating copy to clipboard operation
shell-operator copied to clipboard

Hook snapshot command did not work correctly for hooks with nested paths

Open verdel opened this issue 10 months ago • 0 comments

Expected behavior (what you expected to happen):

I have a hook located in the folder /hooks/100-test/test.sh. I am execute the command /shell-operator hook snapshot 100-test/test.sh and get information about resources

Actual behavior (what actually happened):

I get a 404 page not found response

Steps to reproduce:

  1. Start shell-operator with hook in folder /hooks/100-test/test.sh
  2. Execute command /shell-operator hook snapshot 100-test/test.sh

Environment:

  • Shell-operator version: 1.5.3
  • Kubernetes version: 1.28.13
  • Installation type (kubectl apply, helm chart, etc.): helm chart

Anything else we should know?:

The issue is caused by the fact that the request URL when executing the snapshot command matches the route registered in the debug server only if there is no nesting in the URL.

In other words, if the hook is located in the /hooks/test.sh, the command /shell-operator hook snapshot test.sh will execute successfully.

Unfortunately, chi, which is used as the router, only processes data up to the next “/” in the URL, even if we use a regexp like .*. Therefore, I don’t know yet how to register a route when the depth of the hook file’s nesting is unknown.

verdel avatar Mar 10 '25 15:03 verdel