Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions packages/storage/test/browser/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { ErrorCode } from '../../src/implementation/connection';
import { XhrBytesConnection } from '../../src/platform/browser/connection';

describe('Connections', () => {
describe.only('Connections', () => {

Check failure on line 23 in packages/storage/test/browser/connection.test.ts

View workflow job for this annotation

GitHub Actions / Lint

'describe.only' is restricted from being used
it('XhrConnection.send() should not reject on network errors', async () => {
const fakeXHR = useFakeXMLHttpRequest();
const connection = new XhrBytesConnection();
Expand All @@ -31,11 +31,11 @@
expect(connection.getErrorCode()).to.equal(ErrorCode.NETWORK_ERROR);
fakeXHR.restore();
});
it('XhrConnection.send() should send credentials when using cloud workstation', async () => {
it.only('XhrConnection.send() should send credentials when using cloud workstation', async () => {

Check failure on line 34 in packages/storage/test/browser/connection.test.ts

View workflow job for this annotation

GitHub Actions / Lint

'it.only' is restricted from being used
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