Skip to content

Preserve S3 object keys and close downloaded bodies - #1686

Merged
serengil merged 3 commits into
serengil:masterfrom
Afloat16:fix/s3-raw-keys-and-streams
Nov 9, 2026
Merged

serengil merged 3 commits into
serengil:masterfrom
Afloat16:fix/s3-raw-keys-and-streams

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What has been done

S3 lists raw keys, but reads previously interpreted ? and # as URL delimiters and removed all leading slashes. Preserve the entire key after the bucket separator, including percent sequences, in both the gallery prefix and returned identities. Close the S3 response body after reading and on exceptions.

How to test

python -m pytest -q tests/unit/test_s3_object_paths.py tests/unit/test_filestore.py passed all 15 cases on Python 3.12. All six new cases fail on base a8cee7b. A separate boto3 paginator and botocore Stubber check verified the outgoing keys and cleanup of a real StreamingBody. No AWS account is required for these tests.

@Afloat16
Afloat16 force-pushed the fix/s3-raw-keys-and-streams branch from dd257fc to 45377d2 Compare November 9, 2026 12:23
@Afloat16
Afloat16 force-pushed the fix/s3-raw-keys-and-streams branch from 45377d2 to cfbde17 Compare November 9, 2026 12:45
Flask 3 supplies Werkzeug Headers to the API routes. Include that existing input alongside the dictionary used by gRPC in the validate annotation. Keep the optional header type under TYPE_CHECKING.

Verified the six mypy errors on the unchanged base. With this annotation, all 144 source files pass mypy 1.14.1 under both Flask 3.1.3 and Flask 2.0.2. Pylint scores 10.00/10, the existing token-validation tests pass in both environments, and dictionary, Headers and EnvironHeaders checks cover valid, absent, invalid and disabled authentication.
@Afloat16
Afloat16 force-pushed the fix/s3-raw-keys-and-streams branch from cfbde17 to e7ffeff Compare November 9, 2026 12:56
@serengil
serengil merged commit 00e4fae into serengil:master Nov 9, 2026
3 checks passed
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.

2 participants