Skip to content

Conversation

@aron
Copy link
Contributor

@aron aron commented Oct 18, 2024

This has only recently been introduced in Python 3.13.0 and is currently
inconsistently implemented across different platforms. Confusingly webp
is supported in local development on macOS but not when building the
docker image of a cog model. This is either because it's not defined
in the system mime.types file of the Linux image or because a dev
dependency is manually adding it. I've not done the work to fully
understand which.

This commit introduces a function called in the init script for the cog
package that patches the global mimetypes registry to understand the
.webp extension and image/webp mime type. This will be a no-op on
systems that already understand the type.

This fixes a bug whereby files with the .webp extension are uploaded
to the --upload-url with the incorrect application/octet-stream header.

@aron aron force-pushed the webp-mimetypes-PLAT-341 branch from 19187ef to 181fec7 Compare October 18, 2024 15:13
This has only recently been introduced in Python 3.13.0 and is currently
inconsistently implemented across different platforms. Confusingly webp
is supported in local development on macOS but not when building the
docker image of a cog model. This is either because it's not defined
in the system mime.types file of the Linux image or because a dev
dependency is manually adding it. I've not done the work to fully
understand which.

This commit introduces a function called in the init script for the cog
package that patches the global mimetypes registry to understand the
.webp extension and image/webp mime type. This will be a no-op on
systems that already understand the type.

This fixes a bug whereby files with the .webp extension are uploaded
to the `--upload-url` with the incorrect application/octet-stream header.
@aron aron force-pushed the webp-mimetypes-PLAT-341 branch from 181fec7 to 5595562 Compare November 19, 2024 21:46
@aron aron merged commit 7d26f5d into main Nov 28, 2024
19 checks passed
@aron aron deleted the webp-mimetypes-PLAT-341 branch November 28, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants