Describe the bug
When the install script tries to download the latest release directly from Github, it generates an invalid URL (with newlines between two versions instead of just the latest one) and fails.
To Reproduce
Steps to reproduce the behavior:
Run the install script in an environment that doesn't have homebrew or cargo, nor navi installed already.
See error (note that two versions are mentioned, and there's newlines between them in the generated URL):
(After this more things fail because the gz file wasn't downloaded but they're irrelevant for the bug).
Expected behavior
Install script generates the correct URL and succeeds.
Screenshots
Here's what the latest_version_released function is outputting:
This is because the output of curl -s 'https://api.github.com/repos/denisidoro/navi/releases/latest' includes this line:
"body": "### :sparkles: New features\r\n- [`e3920`](https://github.com/denisidoro/navi/commit/e3920) Add --prevent-interpolation flag (#824)\r\n- [`4b07d`](https://github.com/denisidoro/navi/commit/4b07d) Add support for code blocks using markdown syntax (#807)\r\n\r\n### :bug: Fixes\r\n- [`f8192`](https://github.com/denisidoro/navi/commit/f8192) Fix publish script (#825)\r\n- [`f6414`](https://github.com/denisidoro/navi/commit/f6414) Prevent variable selection content from being limited to 3 columns (#821)\r\n- [`89637`](https://github.com/denisidoro/navi/commit/89637) Correctly calculate character widths (#820)\r\n- [`dee8f`](https://github.com/denisidoro/navi/commit/dee8f) Fix typos\r\n- [`41aa4`](https://github.com/denisidoro/navi/commit/41aa4) Fix preview map \"leaking\" with multiple variables\r\n- [`8b78d`](https://github.com/denisidoro/navi/commit/8b78d) Improve error handling for cheatsh and tldr (#766)\r\n- [`d68c4`](https://github.com/denisidoro/navi/commit/d68c4) Support multi-word arguments in FZF overrides (#765)\r\n- [`81cd7`](https://github.com/denisidoro/navi/commit/81cd7) Fallback to nano if EDITOR isn't set (#764)\r\n\r\n### :computer: Code quality\r\n- [`2b03c`](https://github.com/denisidoro/navi/commit/2b03c) Remove link to Katacoda (#819)\r\n- [`b56d7`](https://github.com/denisidoro/navi/commit/b56d7) Use dns_common library (#818)\r\n- [`8cf9c`](https://github.com/denisidoro/navi/commit/8cf9c) Update dependencies (#817)\r\n- [`317d1`](https://github.com/denisidoro/navi/commit/317d1) Add xonsh support instructions to Installation.md\r\n- [`cb999`](https://github.com/denisidoro/navi/commit/cb999) Refresh README\r\n- [`63681`](https://github.com/denisidoro/navi/commit/63681) Add link to TiddlyWiki plugin\r\n- [`d05fc`](https://github.com/denisidoro/navi/commit/d05fc) Add documentation about Tmux-widget\r\n- [`1823e`](https://github.com/denisidoro/navi/commit/1823e) Fix install script\r\n- [`69075`](https://github.com/denisidoro/navi/commit/69075) Delete dependabot.yml\r\n- [`5c6da`](https://github.com/denisidoro/navi/commit/5c6da) Prettify md/yaml files\r\n- [`9d862`](https://github.com/denisidoro/navi/commit/9d862) Minor code base improvements (#767)\r\n- [`ebb02`](https://github.com/denisidoro/navi/commit/ebb02) Refactor code base (#760)\r\n- [`80f4a`](https://github.com/denisidoro/navi/commit/80f4a) Fix typo in installation docs\r\n- [`9c903`](https://github.com/denisidoro/navi/commit/9c903) feat: add install docu for windows powershell\r\n\r\n### :bangbang: Breaking changes\r\n- [`bd2fe`](https://github.com/denisidoro/navi/commit/bd2fe) Replace target: aarch64-apple-ios by aarch64-apple-darwin (#827)\r\n\r\nNote: the release before this one is [v2.20.1](https://github.com/denisidoro/navi/releases/tag/v2.20.1)",
Which almost at the end, contains the substring Note: the release before this one is [v2.20.1](https://github.com/denisidoro/navi/releases/tag/v2.20.1). This matches the grep pattern (| grep -Eo 'releases/tag/v([0-9\.]+)') used by latest_version_released, and causes it to generate incorrect output.
Versions:
OS: Ubuntu
Shell Version: sh --version complains of sh: 0: Illegal option --. This is in a Github Codespaces environment.
Additional context
N/A
I think instead of greping on the output of the curl call, the most robust solution would be parsing it as JSON and getting the value of the appropriate field (html_url). Or changing the grep pattern so it only matches the exact line it needs.
Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)
Describe the bug When the install script tries to download the latest release directly from Github, it generates an invalid URL (with newlines between two versions instead of just the latest one) and fails.
To Reproduce Steps to reproduce the behavior:
(After this more things fail because the
gz
file wasn't downloaded but they're irrelevant for the bug).Expected behavior Install script generates the correct URL and succeeds.
Screenshots Here's what the
latest_version_released
function is outputting:This is because the output of
curl -s 'https://api.github.com/repos/denisidoro/navi/releases/latest'
includes this line:Which almost at the end, contains the substring
Note: the release before this one is [v2.20.1](https://github.com/denisidoro/navi/releases/tag/v2.20.1)
. This matches the grep pattern (| grep -Eo 'releases/tag/v([0-9\.]+)'
) used bylatest_version_released
, and causes it to generate incorrect output.Versions:
sh --version
complains ofsh: 0: Illegal option --
. This is in a Github Codespaces environment.Additional context N/A
I think instead of
grep
ing on the output of thecurl
call, the most robust solution would be parsing it as JSON and getting the value of the appropriate field (html_url
). Or changing the grep pattern so it only matches the exact line it needs.