Skip to content

Fill out storage bucket url param #4410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/api-review/storage.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```ts

import { FirebaseApp } from '@firebase/app';
import { FirebaseApp } from '@firebase/app-types';
import { FirebaseStorageError } from '@firebase/storage-types/exp';
import { FullMetadata } from '@firebase/storage-types/exp';
import { ListOptions } from '@firebase/storage-types/exp';
Expand Down Expand Up @@ -33,7 +33,7 @@ export function getDownloadURL(ref: StorageReference): Promise<string>;
export function getMetadata(ref: StorageReference): Promise<FullMetadata>;

// @public
export function getStorage(app: FirebaseApp, url?: string): StorageService;
export function getStorage(app: FirebaseApp, bucketUrl?: string): StorageService;

// @public
export function list(ref: StorageReference, options?: ListOptions): Promise<ListResult>;
Expand Down
11 changes: 9 additions & 2 deletions packages/storage/exp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,22 @@ const STORAGE_TYPE = 'storage-exp';
* Gets a Firebase StorageService instance for the given Firebase app.
* @public
* @param app - Firebase app to get Storage instance for.
* @param bucketUrl - The gs:// url to your Firebase Storage Bucket.
* If not passed, uses the app's default Storage Bucket.
* @returns A Firebase StorageService instance.
*/
export function getStorage(app: FirebaseApp, url?: string): StorageService {
export function getStorage(
app: FirebaseApp,
bucketUrl?: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gsUrl?

Feel free to keep as is.

): StorageService {
// Dependencies
const storageProvider: Provider<'storage-exp'> = _getProvider(
app,
STORAGE_TYPE
);
const storageInstance = storageProvider.getImmediate({ identifier: url });
const storageInstance = storageProvider.getImmediate({
identifier: bucketUrl
});
return storageInstance;
}

Expand Down