Shopify / Shopify/liquid

Base64 URL Safe Implementation

Open
#1,862 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing base64_url_safe_encode and base64_url_safe_decode filter implementations, then compare their behavior with RFC 4648 and the Ruby and Microsoft variants described in the issue. Determine whether both padding conventions should be supported, and add tests showing the expected encoding and decoding behavior when the decision is made.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.