Skip to content

bug: wmill.load_s3_file fails with 500 error when S3 filename contains non-ASCII (Chinese) characters #7456

@Ember-Dawn

Description

@Ember-Dawn

Describe the bug

When using wmill.load_s3_file to retrieve a file from an S3-compatible storage (MinIO), the internal API /api/w/{workspace}/job_helpers/download_s3_file returns a 500 Internal Server Error. The error message indicates that the Content-Disposition header generated by the backend contains non-UTF-8 (non-ASCII) characters.

To reproduce

  • Upload a file with Chinese characters in its name (e.g., 这是测试.md) to an S3 bucket configured for Windmill.
  • In a Python script, obtain the S3 object reference (e.g., {'s3': 'windmill_uploads/...'}).
  • Call wmill.load_s3_file(data) in the script.
  • The script fails with a 500 status code during the HTTP request to the internal helper.

Expected behavior

The internal helper should correctly encode the Content-Disposition header (e.g., using filename*= parameter as per RFC 6266) to support non-ASCII filenames, allowing the file to be downloaded successfully.

Screenshots

Image

Browser information

Edge Version 143.0.3650.96

Application version

Windmill Version: 1.599.3 (based on logs)

Additional Context

Relevant Logs

HTTPStatusError: Failed to load S3 file: 500 Internal Server Error - Internal: Error retrieving file: Generic S3 error: Content-Disposition header contained non UTF-8 characters
File ".../mdbook_extractheadings.py", line 26, in main
data = wmill.load_s3_file(data)
^^^^^^^^^^^^^^^^^^^^^^^^
{
"_request": "<Request('GET', 'http://localhost:37381/api/w/cyan/job_helpers/download_s3_file?file_key=...')>",
"response": "<Response [500 Internal Server Error]>"
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions