High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix: parse quota claim as number (#14178)
Daniel Dietzlera3712e40bd02
diff --git a/server/src/services/auth.service.spec.ts b/server/src/services/auth.service.spec.tsindex 3701d3de56..d34e2673f5 100644--- a/server/src/services/auth.service.spec.ts+++ b/server/src/services/auth.service.spec.ts@@ -53,7 +53,7 @@ const oauthUserWithDefaultQuota = {email,name: ' ',oauthId: sub,- quotaSizeInBytes: 1_073_741_824,+ quotaSizeInBytes: '1073741824',storageLabel: null,};@@ -567,7 +567,7 @@ describe('AuthService', () => {oauthResponse,);- expect(userMock.create).toHaveBeenCalledWith(oauthUserWithDefaultQuota);+ expect(userMock.create).toHaveBeenCalledWith({ ...oauthUserWithDefaultQuota, quotaSizeInBytes: 1_073_741_824 });});it('should ignore an invalid storage quota', async () => {@@ -581,7 +581,7 @@ describe('AuthService', () => {oauthResponse,);- expect(userMock.create).toHaveBeenCalledWith(oauthUserWithDefaultQuota);+ expect(userMock.create).toHaveBeenCalledWith({ ...oauthUserWithDefaultQuota, quotaSizeInBytes: 1_073_741_824 });});it('should ignore a negative quota', async () => {@@ -595,7 +595,7 @@ describe('AuthService', () => {oauthResponse,);- expect(userMock.create).toHaveBeenCalledWith(oauthUserWithDefaultQuota);+ expect(userMock.create).toHaveBeenCalledWith({ ...oauthUserWithDefaultQuota, quotaSizeInBytes: 1_073_741_824 });});it('should not set quota for 0 quota', async () => {diff --git a/server/src/services/auth.service.ts b/server/src/services/auth.service.tsindex b0094ae9ed..0d44fa0562 100644--- a/server/src/services/auth.service.ts+++ b/server/src/services/auth.service.ts@@ -1,5 +1,5 @@import { BadRequestException, ForbiddenException, Injectable, UnauthorizedException } from '@nestjs/common';-import { isNumber, isString } from 'class-validator';+import { isString } from 'class-validator';import cookieParser from 'cookie';import { DateTime } from 'luxon';import { IncomingHttpHeaders } from 'node:http';@@ -226,7 +226,7 @@ export class AuthService extends BaseService {const storageQuota = this.getClaim(profile, {key: storageQuotaClaim,default: defaultStorageQuota,- isValid: (value: unknown) => isNumber(value) && value >= 0,+ isValid: (value: unknown) => Number(value) >= 0,});const userName = profile.name ?? `${profile.given_name || ''} ${profile.family_name || ''}`;