Skip to content

Conversation

@Gijsreyn
Copy link
Contributor

PR Summary

This pull request adds the dataUri and dataUriToString functions, including tests and documentation.

PR Context

Partially addresses #57.

@Gijsreyn Gijsreyn force-pushed the gh-57/main/add-datauri-functions branch from bf06fc1 to aa04b78 Compare January 12, 2026 23:22
Copy link
Contributor

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 pull request adds two new DSC configuration functions: dataUri() and dataUriToString(). The dataUri() function converts a string to a base64-encoded data URI format, while dataUriToString() performs the inverse operation by decoding a data URI back to its original string.

Changes:

  • Added dataUri() function to convert strings to data URI format with base64 encoding
  • Added dataUriToString() function to decode base64-encoded data URIs back to strings
  • Included comprehensive unit tests and integration tests for both functions
  • Added documentation with examples for both functions

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
lib/dsc-lib/src/functions/mod.rs Registered the new data_uri and data_uri_to_string modules in alphabetical order
lib/dsc-lib/src/functions/data_uri.rs Implemented dataUri() function that encodes strings as base64 data URIs with application/json media type
lib/dsc-lib/src/functions/data_uri_to_string.rs Implemented dataUriToString() function that decodes base64-encoded data URIs to strings with UTF-8 validation
lib/dsc-lib/locales/en-us.toml Added localization strings for function descriptions and error messages
dsc/tests/dsc_functions.tests.ps1 Added comprehensive PowerShell integration tests covering normal operation, error cases, and edge cases
docs/reference/schemas/config/functions/overview.md Added references to the new functions in the string functions section
docs/reference/schemas/config/functions/dataUri.md Added documentation for dataUri() function with examples and parameter descriptions
docs/reference/schemas/config/functions/dataUriToString.md Added documentation for dataUriToString() function with examples and exception details

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

if *part == "base64" {
has_base64 = true;
} else if part.starts_with("charset=") {
charset_count += 1;
Copy link
Member

Choose a reason for hiding this comment

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

Instead of having charset_count, you should just check if charset.is_some() (after renaming charset_value to just charset since it'd be the only variable)

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