Commit cdb84fc
committed
Fix srcset URI sanitization for URLs with commas
CDN image resizers (e.g. Cloudflare) use commas in URL paths
like cdn-cgi/image/format=auto,quality=80,width=412/...
which were incorrectly split by the naive comma-based
preg_split in wp_kses_sanitize_uris(). This rewrites the
splitting to use the srcset descriptor pattern (e.g. 480w,
2x) as entry boundaries, preserving commas within URLs.
Also preserves original whitespace around separators instead
of normalizing with implode.1 parent f11aeb2 commit cdb84fc
2 files changed
Lines changed: 39 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1686 | 1686 | | |
1687 | 1687 | | |
1688 | 1688 | | |
1689 | | - | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | 1689 | | |
1696 | 1690 | | |
1697 | | - | |
1698 | | - | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1699 | 1726 | | |
1700 | 1727 | | |
1701 | | - | |
| 1728 | + | |
1702 | 1729 | | |
1703 | 1730 | | |
1704 | 1731 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2502 | 2502 | | |
2503 | 2503 | | |
2504 | 2504 | | |
2505 | | - | |
| 2505 | + | |
2506 | 2506 | | |
2507 | 2507 | | |
2508 | 2508 | | |
| |||
2580 | 2580 | | |
2581 | 2581 | | |
2582 | 2582 | | |
2583 | | - | |
2584 | | - | |
| 2583 | + | |
| 2584 | + | |
2585 | 2585 | | |
2586 | 2586 | | |
2587 | 2587 | | |
| |||
0 commit comments