Commit 921d09c
committed
Media: Exclude IMG tags from crossorigin injection in media templates.
The client-side media processing feature added `crossorigin="anonymous"` to AUDIO, IMG, and VIDEO tags in the Backbone media templates printed by `wp_print_media_templates()`. Forcing the attribute on IMG tags triggers CORS requests that fail for images served without `Access-Control-Allow-Origin` headers, breaking media library previews for media offloaded to a CDN.
This is the same problem previously fixed for `wp_add_crossorigin_attributes()` in [62048]: under `Document-Isolation-Policy: isolate-and-credentialless`, browsers load cross-origin images in credentialless mode, so the attribute is unnecessary on IMG tags. The media templates have a separate injection path that was missed at the time. Remove IMG from the list of tags receiving the attribute so both paths match. AUDIO and VIDEO tags are unchanged.
Follow-up to [62048].
Props khokansardar, iamchitti, ianmjones, swissspidy.
Fixes #65673.
git-svn-id: https://develop.svn.wordpress.org/trunk@62819 602fd350-edb4-49c9-b593-d223f7449a821 parent 2c49c06 commit 921d09c
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1619 | 1619 | | |
1620 | 1620 | | |
1621 | 1621 | | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1622 | 1628 | | |
1623 | 1629 | | |
1624 | 1630 | | |
1625 | 1631 | | |
1626 | | - | |
| 1632 | + | |
1627 | 1633 | | |
1628 | 1634 | | |
1629 | 1635 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
541 | 567 | | |
0 commit comments