Skip to content

Conversation

@GordonSmith
Copy link
Member

@GordonSmith GordonSmith commented Nov 25, 2025

Checklist:

  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit message includes a "fixes" reference if appropriate.
    • The commit is signed.
  • The change has been fully tested:
    • I have viewed all related gallery items
    • I have viewed all related dermatology items
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised new issues to address them separately

Testing:

Copy link

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 replaces the btoa polyfill with a custom utf8ToBase64 utility function to properly handle UTF-8 encoding in authentication headers. The original btoa implementation in Node.js incorrectly encoded multi-byte UTF-8 characters, which could cause authentication failures when usernames or passwords contain non-ASCII characters.

Key Changes:

  • Created a new utf8ToBase64 utility function with proper UTF-8 encoding support for both Node.js and browser environments
  • Replaced btoa usage in the authentication header generation with the new utility
  • Removed the problematic btoa polyfill from Node.js initialization code

Reviewed changes

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

Show a summary per file
File Description
packages/util/src/utf8ToBase64.ts New utility function that properly encodes UTF-8 strings to Base64, with fallbacks for different environments
packages/util/tests/utf8ToBase64.spec.ts Browser-compatible tests for ASCII and nullish value handling
packages/util/tests/utf8ToBase64.node.spec.ts Node.js-specific tests for multi-byte character encoding and fallback behavior
packages/util/src/index.ts Exports the new utf8ToBase64 function
packages/comms/src/connection.ts Updated to import and use utf8ToBase64 instead of btoa for authentication header
packages/comms/src/index.node.ts Removed the problematic btoa polyfill and moved Buffer import
packages/comms/src/index.common.ts Minor whitespace cleanup
packages/comms/index.html Added console logging for debugging workunit operations
packages/comms/.vscode/launch.json Updated local development server port

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
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.

1 participant