xtendo-org / chips

A fast, lightweight, and concurrent plugin manager for the fish shell, written in Haskell
73 stars 3 forks source link

chips self-update fail: failed parsing the GitHub releases page. Perhaps you need to manually upgrade. #33

Open xnuk opened 1 year ago

xnuk commented 1 year ago

Related: https://github.com/xtendo-org/chips/blob/54846413660536a24d4a9c884b6a33c2d86ad256/src/SelfUpdate.hs#L53-L58

First, yes I still use chips, and second, HTTP header name is case-insensitive. Don't know why but after HTTP/2, many web pages started to just use lowercase for all HTTP header names, including GitHub:

$ curl -I https://github.com/xtendo-org/chips/releases/latest
HTTP/2 302
server: GitHub.com
date: Fri, 31 Mar 2023 10:59:48 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With
location: https://github.com/xtendo-org/chips/releases/tag/1.1.2
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
(...)

Haskell's best networking library, readProcess "curl", has -w/--write-out <format> option to give some variables:

curl -w '%{redirect_url}' https://github.com/xtendo-org/chips/releases/latest

Or, if you prefer another way:

curl -w '%header{location}' https://github.com/xtendo-org/chips/releases/latest