@@ -79,6 +79,7 @@ export function uploadBytes(
79
79
data : Blob | Uint8Array | ArrayBuffer ,
80
80
metadata ?: UploadMetadata
81
81
) : Promise < UploadResult > {
82
+ ref = getModularInstance ( ref ) ;
82
83
return uploadBytesInternal (
83
84
ref as Reference ,
84
85
data ,
@@ -102,6 +103,7 @@ export function uploadString(
102
103
format ?: string ,
103
104
metadata ?: UploadMetadata
104
105
) : Promise < UploadResult > {
106
+ ref = getModularInstance ( ref ) ;
105
107
return uploadStringInternal (
106
108
ref as Reference ,
107
109
value ,
@@ -124,6 +126,7 @@ export function uploadBytesResumable(
124
126
data : Blob | Uint8Array | ArrayBuffer ,
125
127
metadata ?: UploadMetadata
126
128
) : UploadTask {
129
+ ref = getModularInstance ( ref ) ;
127
130
return uploadBytesResumableInternal (
128
131
ref as Reference ,
129
132
data ,
@@ -139,6 +142,7 @@ export function uploadBytesResumable(
139
142
* @param ref - StorageReference to get metadata from.
140
143
*/
141
144
export function getMetadata ( ref : StorageReference ) : Promise < FullMetadata > {
145
+ ref = getModularInstance ( ref ) ;
142
146
return getMetadataInternal ( ref as Reference ) as Promise < FullMetadata > ;
143
147
}
144
148
@@ -155,6 +159,7 @@ export function updateMetadata(
155
159
ref : StorageReference ,
156
160
metadata : SettableMetadata
157
161
) : Promise < FullMetadata > {
162
+ ref = getModularInstance ( ref ) ;
158
163
return updateMetadataInternal (
159
164
ref as Reference ,
160
165
metadata as Partial < MetadataInternal >
@@ -187,6 +192,7 @@ export function list(
187
192
ref : StorageReference ,
188
193
options ?: ListOptions
189
194
) : Promise < ListResult > {
195
+ ref = getModularInstance ( ref ) ;
190
196
return listInternal ( ref as Reference , options ) ;
191
197
}
192
198
@@ -210,6 +216,7 @@ export function list(
210
216
* folder. `nextPageToken` is never returned.
211
217
*/
212
218
export function listAll ( ref : StorageReference ) : Promise < ListResult > {
219
+ ref = getModularInstance ( ref ) ;
213
220
return listAllInternal ( ref as Reference ) ;
214
221
}
215
222
@@ -220,6 +227,7 @@ export function listAll(ref: StorageReference): Promise<ListResult> {
220
227
* URL for this object.
221
228
*/
222
229
export function getDownloadURL ( ref : StorageReference ) : Promise < string > {
230
+ ref = getModularInstance ( ref ) ;
223
231
return getDownloadURLInternal ( ref as Reference ) ;
224
232
}
225
233
@@ -230,6 +238,7 @@ export function getDownloadURL(ref: StorageReference): Promise<string> {
230
238
* @returns A promise that resolves if the deletion succeeds.
231
239
*/
232
240
export function deleteObject ( ref : StorageReference ) : Promise < void > {
241
+ ref = getModularInstance ( ref ) ;
233
242
return deleteObjectInternal ( ref as Reference ) ;
234
243
}
235
244
@@ -256,14 +265,11 @@ export function ref(
256
265
serviceOrRef : StorageService | StorageReference ,
257
266
pathOrUrl ?: string
258
267
) : StorageReference | null {
259
- if ( serviceOrRef instanceof Reference ) {
260
- return refInternal ( serviceOrRef as Reference , pathOrUrl ) ;
261
- } else {
262
- return refInternal (
263
- getModularInstance ( serviceOrRef ) as StorageServiceInternal ,
264
- pathOrUrl
265
- ) ;
266
- }
268
+ serviceOrRef = getModularInstance ( serviceOrRef ) ;
269
+ return refInternal (
270
+ serviceOrRef as StorageServiceInternal | Reference ,
271
+ pathOrUrl
272
+ ) ;
267
273
}
268
274
269
275
/**
@@ -287,9 +293,9 @@ export function getStorage(
287
293
app : FirebaseApp ,
288
294
bucketUrl ?: string
289
295
) : StorageService {
290
- // Dependencies
296
+ app = getModularInstance ( app ) ;
291
297
const storageProvider : Provider < 'storage-exp' > = _getProvider (
292
- getModularInstance ( app ) ,
298
+ app ,
293
299
STORAGE_TYPE
294
300
) ;
295
301
const storageInstance = storageProvider . getImmediate ( {
0 commit comments