AdvancedCustomFields / AdvancedCustomFields/acf

Trim whitespace on Link fields url

Open
#617 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hello there,

I just realized that it was possible for to add a trailing whitespace at the end of an URL while editing a Link field:

Capture d’écran 2022-03-02 à 14 00 53

It's not a big deal, I just added a function on the acf/update_value/type=link filter to trim these whitespaces, but I can't see any use case where someone needs to keep them. So my question is : Shouldn't it be included in the sanitization process done by ACF itself ?

Contributor guide

No contributing guide indexed for this repository

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 tracing the acf/update_value/type=link filter and the Link field sanitization path for the URL value. Confirm how trailing whitespace is currently stored, then verify that the URL is trimmed without affecting other Link field values.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.