Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 5 additions & 0 deletions .changeset/brown-pens-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/storage": patch
---

Fixed issue where Storage on Firebase Studio throws CORS errors.
2 changes: 1 addition & 1 deletion packages/storage/src/platform/browser/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class XhrConnection<T extends ConnectionType>
if (this.sent_) {
throw internalError('cannot .send() more than once');
}
if (isCloudWorkstation(url) && isUsingEmulator) {
if (isCloudWorkstation(new URL(url).hostname) && isUsingEmulator) {
this.xhr_.withCredentials = true;
}
this.sent_ = true;
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/test/browser/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Connections', () => {
const fakeXHR = useFakeXMLHttpRequest();
const connection = new XhrBytesConnection();
const sendPromise = connection.send(
'https://abc.cloudworkstations.dev',
'https://abc.cloudworkstations.dev/test',
'GET',
true
);
Expand Down
Loading