input-output-hk / cicero

event-driven automation for Nomad
https://handbook.cicero.ci.iog.io
41 stars 11 forks source link

Creating an action with branch `ref` cannot handle branch names with `/` #74

Closed HeinrichApfelmus closed 1 year ago

HeinrichApfelmus commented 1 year ago

Problem description

I'm trying to create a new action on https://cicero.ci.iog.io/action/new.

Into the text field, I enter a repository and specify a branch using ref

github.com/input-output-hk/cardano-wallet?ref=HeinrichApfelmus/cicero/test-integration

and click the button. However, instead of landing on an action page, I land on a 404 page with the error message

While listing Actions in "github.com/input-output-hk/cardano-wallet?ref=HeinrichApfelmus/cicero/test-integration": error downloading 'https://github.com/input-output-hk/cardano-wallet.git//cicero/test-integration?ref=HeinrichApfelmus': 2 errors occurred:
    * /nix/store/qp851b10ppwi6csj6ajaygpy9yshxf0c-git-minimal-2.37.3/bin/git exited with 128: Cloning into '/local/.cache/cicero/sources/Z2l0aHViLmNvbS9pbnB1dC1vdXRwdXQtaGsvY2FyZGFuby13YWxsZXQ_cmVmPUhlaW5yaWNoQXBmZWxtdXMvY2ljZXJvL3Rlc3QtaW50ZWdyYXRpb24'...
remote: Not Found
fatal: repository 'https://github.com/input-output-hk/cardano-wallet.git//cicero/test-integration/' not found

    * bad response code: 404

Probable cause

Looking at the error message, it looks like the UI cannot handle branch names with slashes (/) in them — the checkout path is mangled into

https://github.com/input-output-hk/cardano-wallet.git//cicero/test-integration?ref=HeinrichApfelmus

Trying to escape the string after ?ref= does not seem to work — presumably, the parser is very simple and just splits the input string by /.

dermetfan commented 1 year ago

To escape a / in a URL you need to percent-encode it: github.com/input-output-hk/cardano-wallet?ref=HeinrichApfelmus%2Fcicero%2Ftest-integration