Repository navigation
fix(firebase_storage): keep custom metadata on data url uploads - #18761
rootkiller6788 wants to merge 2 commits into
Conversation
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.
Using Gemini Code AssistThe 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
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 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. |
上传 data url 时传的 metadata 会丢掉 customMetadata。
putString 走 PutStringFormat.dataUrl 时会重建一遍 SettableMetadata 好把 url 里的 content type 填进去,这一份拷贝没带上 customMetadata,所以像 {'activity': 'test'} 这种自定义字段就悄无声息地没了。putData/putBlob 推断 content type 的时候是保留的,putString 这边应该是漏了,就照着补上。
另外补了个测试。我先在旧代码上跑过,是会失败的。