homebysix / recipe-robot

A kick ass tool for creating AutoPkg recipes.
Apache License 2.0
300 stars 28 forks source link

Recipe Robot curl command fails when URL contains `&` #197

Closed homebysix closed 9 months ago

homebysix commented 9 months ago

Describe the bug Recipe Robot produces an error when processing a URL that contains an unescaped ampersand, even if the URL is valid. This is due to an upstream failure in curl.

This URL, including spaces and ampersand, is valid. It downloads a file when loaded in a browser:
http://s3.amazonaws.com/belightsoft/updates/Labels & Addresses.tar.bz2

However, when processing with curl, an error is produced:

% curl -svIL "http://s3.amazonaws.com/belightsoft/updates/Labels & Addresses.tar.bz2"
* URL rejected: Malformed input to a URL function
* Closing connection -1

One solution may be to quote the URL:

% curl -sIL 'http://s3.amazonaws.com/belightsoft/updates/Labels%20%26%20Addresses.tar.bz2'
HTTP/1.1 200 OK
x-amz-id-2: XviSCCGlT2tQ4Es6W0n8z3AqVxmrlX6nmvVAQ7u3jkxmzq6geD0pA8/jPxdvl6SrnWcEzwgsLmw=
x-amz-request-id: DD3MXYWXEF14655Y
Date: Sun, 15 Oct 2023 20:48:41 GMT
Last-Modified: Mon, 16 May 2016 12:13:00 GMT
ETag: "84629ef3b7ca93e1f61ae1ce0d04cb63"
Accept-Ranges: bytes
Content-Type: application/x-bzip2
Server: AmazonS3
Content-Length: 47212146

However it's hard to tell which URLs to quote and which to leave as is.

Environment:

homebysix commented 9 months ago

Should be resolved in v2.3.0.