Skip to content

Base64 URL Safe Implementation #1862

Open
@microalps

Description

Base64 filters were added in Liquid 5.1 together with URL safe variants. There seems to be two variants out in the wild, and the question is can/should Liquid support both? base64_url_safe_decode supports both. base64_url_safe_encode does not.

  1. Ruby's implementation swaps + and / only
  2. Microsoft's implementations (Microsoft.IdentityModel.Tokens, System.Buffers.Text of .NET9) also remove the = padding.

RFC 4648

The pad character "=" is typically percent-encoded when used in an URI, but if the data length is known implicitly, this can be avoided by skipping the padding

Mozilla defines it as

A common variant is "Base64 URL safe", which omits the padding and replaces +/

Related to dotliquid#542

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions