Skip to content

Conversation

@keturn
Copy link
Contributor

@keturn keturn commented Aug 7, 2023

Some clients, including whatever GIMP uses when you do "Open Location", do a HEAD request on a resource before downloading it.

Currently the image route only supports GET, so the HEAD request fails.

This lack of support for HEAD requests is something that should be addressed generally:

but in the meantime, I guess we handle it on a case-by-case basis? This PR adds HEAD to the route for {image}/full.

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

QA Instructions, Screenshots, Recordings

Test instructions:

  • get the URL for a full image, perhaps by doing right-click Open in New Tab and copying that URL.
  • issue a HTTP HEAD request for that URL (maybe using httpie or your other favorite HTTP test client) or with File/Open Location in GIMP.
  • ensure the request receives a 200 OK response and/or the image opens.

Copy link
Contributor

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

❯ curl --head http://localhost:5173/api/v1/images/i/755d703e-f47d-436f-be3f-2920fc203d4c.png/full
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
date: Tue, 08 Aug 2023 03:04:52 GMT
server: uvicorn
content-type: image/png
content-disposition: inline; filename="755d703e-f47d-436f-be3f-2920fc203d4c.png"
cache-control: max-age=31536000
content-length: 424646
last-modified: Mon, 07 Aug 2023 14:00:09 GMT
etag: 0138f253d3b3a77902408f2514e29362
connection: close

@keturn keturn enabled auto-merge August 8, 2023 07:02
@keturn keturn merged commit 2b3b77a into main Aug 8, 2023
@keturn keturn deleted the feat/image_http_head branch August 8, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants