Skip to content

Address non-ASCII filename support for files, audio, etc.#75

Merged
trrwilson merged 3 commits intomainfrom
user/travisw/mpfd-unicode-filenames
Jun 19, 2024
Merged

Address non-ASCII filename support for files, audio, etc.#75
trrwilson merged 3 commits intomainfrom
user/travisw/mpfd-unicode-filenames

Conversation

@trrwilson
Copy link
Collaborator

Fixes #72.

The library's multipart/form-data implementation uses custom logic to bypass the use of the filename* Content-Disposition parameter, which is RFC 6266's method of encoding non-ASCII filenames in multipart/form-data requests. This bypass was made in deference to an interpretation of RFC 7578 wherein the use of filename* is disallowed.

This PR removes the restriction by directly using System.Net.Http.MultipartFormDataContent.Add()'s filename* behavior.

Although pending discussion with the Base Common Library team is still needed to clarify best interoperability practices, this is a better current state because:

  • It aligns with the existing language type in System.Net.Http
  • The interpretation of the competing RFC is ambiguous; it appears it may not be making a statement about the filename* parameter itself, but rather on the use of the encoding scheme of the newer filename* in the older filename
  • Most importantly, it fixes the readily observable issue against the OpenAI V1 endpoint -- and still leaves the older filename intact for any unanticipated backwards compatibility issues with API gateways or other intermediaries

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.

When I upload a file with a Chinese txt format or other format in the file name, it prompts that the uploaded file does not support it

3 participants