Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): handle Content-Type with charset in fetch error handling (#10777)

fengmk23417cc5dc11f
diff --git a/packages/frontend/core/src/modules/cloud/services/fetch.ts b/packages/frontend/core/src/modules/cloud/services/fetch.ts
index 7310919f18..f7e7692227 100644
--- a/packages/frontend/core/src/modules/cloud/services/fetch.ts
+++ b/packages/frontend/core/src/modules/cloud/services/fetch.ts
@@ -85,7 +85,7 @@ export class FetchService extends Service {
stacktrace: error.stack,
});
} else {
- if (res.headers.get('Content-Type') === 'application/json') {
+ if (res.headers.get('Content-Type')?.startsWith('application/json')) {
throw UserFriendlyError.fromAny(await res.json());
} else {
throw UserFriendlyError.fromAny(await res.text());