Skip to content

fix(firebase_storage): keep custom metadata on data url uploads - #18761

Open
rootkiller6788 wants to merge 2 commits into
firebase:mainfrom
rootkiller6788:fix-putstring-custom-metadata
Open

rootkiller6788 wants to merge 2 commits into
firebase:mainfrom
rootkiller6788:fix-putstring-custom-metadata

Conversation

@rootkiller6788

Copy link
Copy Markdown

上传 data url 时传的 metadata 会丢掉 customMetadata。

putString 走 PutStringFormat.dataUrl 时会重建一遍 SettableMetadata 好把 url 里的 content type 填进去,这一份拷贝没带上 customMetadata,所以像 {'activity': 'test'} 这种自定义字段就悄无声息地没了。putData/putBlob 推断 content type 的时候是保留的,putString 这边应该是漏了,就照着补上。

另外补了个测试。我先在旧代码上跑过,是会失败的。

putString() with PutStringFormat.dataUrl rebuilds the metadata object to fill
in the content type taken from the url, and that copy was missing the custom
metadata, so whatever the caller passed in got dropped without a word.
putData/putBlob keep it when they infer the content type, so this just makes
putString behave the same way.
The other put* methods have a test that custom metadata survives content type
inference; putString did not, which is probably how the data url case slipped
through. Ran it against the old code first and it fails there.
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@rootkiller6788
rootkiller6788 marked this pull request as ready for review October 7, 2026 04:31

This branch has not been deployed

No deployments
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.

1 participant