ezyang / ezyang/htmlpurifier

Image Style Percentage

Open
#151 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

Why are image style height percentage stripped but not for pixels?

Input

<img class="img-fluid" src="/storage/uploads/abc.jpeg" alt="abc.jpeg" style="width: 25%;">

Output

<img class="img-fluid" src="/storage/uploads/abc.jpeg" alt="abc.jpeg">

I've configured my settings as follows, including style within img[]

'HTML.Allowed'             => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src|class|style]',

If I pass the height and width as pixels, it works as expected.

Thanks

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 reproducing the reported HTML.Allowed configuration with an img style containing a percentage and compare it with pixel dimensions. Trace the sanitizer's handling of img style values; done means determining whether percentage heights and widths are intentionally filtered and documenting or correcting the behavior with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security
Issue type
Bug
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.