File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Unreleased
2+ - [ fixed] Fixed ` InstanceCache ` keying by bucket only, which caused named apps sharing a
3+ storage bucket with the default app to use the wrong auth context. (#16039 )
4+
15# 12.9.0
26- [ fixed] Fix "weak never mutated" build warning introduced in Xcode 26.2.
37
Original file line number Diff line number Diff line change @@ -244,8 +244,9 @@ internal import FirebaseCoreExtension
244244 private final class InstanceCache : @unchecked Sendable {
245245 static let shared = InstanceCache ( )
246246
247- /// A map of active instances, grouped by app. Keys are FirebaseApp names and values are
248- /// instances of Storage associated with the given app.
247+ /// A map of active instances, grouped by app and bucket. Keys combine the
248+ /// FirebaseApp name and bucket to ensure each app gets its own Storage
249+ /// instance, even when multiple apps share the same storage bucket.
249250 private var instances : [ String : Storage ] = [ : ]
250251
251252 /// Lock to manage access to the instances array to avoid race conditions.
@@ -257,11 +258,12 @@ internal import FirebaseCoreExtension
257258 os_unfair_lock_lock ( & instancesLock)
258259 defer { os_unfair_lock_unlock ( & instancesLock) }
259260
260- if let instance = instances [ bucket] {
261+ let key = " \( app. name) | \( bucket) "
262+ if let instance = instances [ key] {
261263 return instance
262264 }
263265 let newInstance = FirebaseStorage . Storage ( app: app, bucket: bucket)
264- instances [ bucket ] = newInstance
266+ instances [ key ] = newInstance
265267 return newInstance
266268 }
267269 }
You can’t perform that action at this time.
0 commit comments