Skip to content
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

fix: parse quota claim as number #14178

Merged
merged 1 commit into from
Nov 19, 2024
Merged

fix: parse quota claim as number #14178

merged 1 commit into from
Nov 19, 2024

Conversation

danieldietzler
Copy link
Member

Fixes #14160

@@ -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) => isNumber(value) && Number(value) >= 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the number conversion won't do anything, because isNumber checks if the value is a number and returns false otherwise. Shouldn't the value be converted to a number beforehand?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh you're right, good catch!

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I don't even need the isNumber check because Number.NaN >= 0 === false

Verified

This commit was signed with the committer’s verified signature.
danieldietzler Daniel Dietzler
@alextran1502 alextran1502 merged commit a3712e4 into main Nov 19, 2024
36 checks passed
@alextran1502 alextran1502 deleted the fix/quota-claim-number branch November 19, 2024 21:40
yosit pushed a commit to yosit/immich that referenced this pull request Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OAuth with Keycloak Quota claim not set
4 participants