Skip to content

Add error handling for optional field when left empty #594

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

Merged
merged 1 commit into from
Apr 25, 2025
Merged

Conversation

robinske
Copy link
Collaborator

Description

Deploying from the CodeExchange leaves an "empty string" without stripping the quotes. This change handles that edge case.

image

Checklist

  • I ran npm test passkeys-backend locally and it passed without errors.
  • I acknowledge that all my contributions will be made under the project's license.

Related issues

@robinske robinske requested a review from Copilot April 25, 2025 13:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces error handling for the optional ANDROID_APP_KEYS field when it is left as an empty string. Key changes include:

  • Adding a test case for handling an empty string for ANDROID_APP_KEYS.
  • Introducing the androidOrigins helper function to parse and sanitize the keys.
  • Updating the request body to use the parsed origins in the API call.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
passkeys-backend/tests/registration-start.test.js Added test to ensure empty ANDROID_APP_KEYS is handled
passkeys-backend/functions/registration/start.js Added androidOrigins to parse ANDROID_APP_KEYS and updated request body
Comments suppressed due to low confidence (1)

passkeys-backend/functions/registration/start.js:25

  • [nitpick] Consider renaming 'androidOrigins' to 'parseAndroidOrigins' to more clearly express that this function parses the keys.
const androidOrigins = (keys) => {

@robinske robinske requested a review from bnb April 25, 2025 13:35
@robinske robinske merged commit 7450d55 into main Apr 25, 2025
2 checks passed
@robinske robinske deleted the passkeys-bug branch April 25, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants