-
Notifications
You must be signed in to change notification settings - Fork 1
Fix: ImageField losing progressive JPEG flag #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/async
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [project] | ||
| name = "mongoengine" | ||
| version = "0.30.0" | ||
| version = "0.29.0" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That change wasn’t intentional from my side. |
||
| description = "MongoEngine is a Python Object-Document Mapper for working with MongoDB." | ||
| authors = [ | ||
| { name = "Harry Marr", email = "harry.marr@gmail.com" } | ||
|
|
@@ -33,21 +33,14 @@ classifiers = [ | |
| ] | ||
| requires-python = ">=3.10" | ||
| dependencies = [ | ||
| "pymongo (>=4.14,<5.0)", | ||
| "pymongo (>=4.13,<5.0)", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That change wasn’t intentional from my side. |
||
| ] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "ruff (>=0.14)", | ||
| "pre-commit (>=4.5)" | ||
| ] | ||
| docs = [ | ||
| "docutils==0.21.2", | ||
| "jinja2==3.1.6", | ||
| "readthedocs-sphinx-ext==2.2.5", | ||
| "sphinx==7.4.7", | ||
| "sphinx-rtd-theme==3.0.2", | ||
| ] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change was unintentional from my local setup. I’m reverting it now so the PR only contains the intended changes. Thanks for flagging this, and sorry for the trouble. |
||
| test = [ | ||
| "pytest (>=9.0)", | ||
| "pytest-asyncio (>=1.3)", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the logic and how it fixes the issue?
Ref: https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#jpeg-saving
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic mixes two different sources for progressive:
Because of this, the final value of progressive ends up being inconsistent and confusing as it can change depending on metadata and then get overridden again.This matches what the todo comment warning about i.e unused/bad implementation
my change simplifies this and make the behavior predictable and explicit as:
Instead of partially inheriting behavior from img.info the save behavior now follows only what the user asked for at save time. This removes the ambiguity the TODO is pointing out and avoids hidden behavior coming from the source image
This also aligns with Pillow’s docs: progressive is a save time option for JPEGs, not something that should be implicitly inherited unless we explicitly support that behavior
If the project prefers preserving the original image’s progressive flag, we can later support a "keep" style option (similar as quality="keep" in Pillow), but this change was mainly to clean up the TODO and make the current behavior correct and deterministic