Hook snapshot command did not work correctly for hooks with nested paths
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:
- Start shell-operator with hook in folder
/hooks/100-test/test.sh - 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.