cockpit-project / cockpit-project.github.io

Cockpit Project Website
https://cockpit-project.org/
MIT License
115 stars 200 forks source link

scripts: Handle redirects in image URLs #656

Closed garrett closed 1 year ago

garrett commented 1 year ago

GitHub changed the way they handle images; their URLs might not have an extension now. For the time being, we should assume the images without extensions are PNG files.

We will probably want to download whatever they are and run some identification on them in the future (like the file command).

I also switched the string extension and string concat to use native Ruby File.* commands.

jelly commented 1 year ago

This does not seem to work for me:

Re-added release-note for this image https://github.com/cockpit-project/cockpit/pull/17796 which works but now get's an extra .. the other image is empty.

[jelle@t14s][~/projects/cockpit-project.github.io]%file images/299-networking-add-support-for-wireguard-2.png
images/299-networking-add-support-for-wireguard-2.png: empty
[jelle@t14s][~/projects/cockpit-project.github.io]%file images/299-storage-set-up-a-system-to-use-nbde..png
images/299-storage-set-up-a-system-to-use-nbde..png: PNG image data, 853 x 313, 8-bit/color RGBA, non-interlaced
garrett commented 1 year ago

Addressed your issues and integrated your suggestions @ https://github.com/cockpit-project/cockpit-project.github.io/pull/657, but added multiple redirect support (recursive calling based on response) and error handling.

If this is merged, it:

closes #657