2021年4月23日星期五

CURL Download of TIFF Content Not Working

I'm trying to download images from an API and my curl command is not working for TIFF content types. The API relies on serial numbers and does not include image format. My plan is to pull the header first, then run CURL again based on the content type. Here's the header I'm getting:

HTTP/1.1 200 OK Last-Modified: Fri, 01 Feb 2002 01:02:00 GMT Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000 Server: CA-API-Gateway/9.0 Content-Type: image/tiff;charset=UTF-8 Content-Length: 2876 Date: Fri, 23 Apr 2021 23:53:11 GMT Connection: close Content-Security-Policy: frame-ancestors https://*.an.agency.gov:* X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN   

I'm using the below CURL command:

curl -X GET https://URL/STUFF/12345678 > /storage/12345678.tiff -H API-KEY  

When I do do this assuming JPG as the extension, the JPG content URL's save correctly and are viewable.

Here's what the JPG content headers look like:

HTTP/1.1 200 OK Last-Modified: Wed, 01 Oct 2008 12:55:33 GMT Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000 Server: CA-API-Gateway/9.0 Content-Type: image/jpeg;charset=UTF-8 Transfer-Encoding: chunked Date: Fri, 23 Apr 2021 23:53:05 GMT Connection: close Content-Security-Policy: frame-ancestors https://*.an.agency.gov:* X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN   

Kinda stumped here.

UPDATE:

I ran a GM Convert command on a downloaded TIF and got the following error:

Improper image header

Any ideas how to fix this? It seems the API is doing something to make the TIFF image displayable in the browser, but it seems to be messing up the file download.

https://stackoverflow.com/questions/67238147/curl-download-of-tiff-content-not-working April 24, 2021 at 08:10AM

没有评论:

发表评论