Commit b6a12a5
committed
Media: Consistently escape URLs in attachment download links and JS data.
The "Download file" link in `attachment_submitbox_metadata()` escaped its `href` with `esc_attr()`, which only HTML-encodes the value. Use `esc_url()` instead, the correct function for a URL in an `href` attribute, since `$att_url` comes from `wp_get_attachment_url()`. This applies the same escaping method for the Download link in the media list table output by `WP_Media_List_Table::_get_row_actions()`.
Apply the same correction to `wp_prepare_attachment_for_js()`, wrapping the attachment, intermediate size, full-size, original image, and image source URLs in `esc_url_raw()` so the Backbone-rendered media UI emits URLs filtered through `clean_url` just like the server-rendered templates.
Developed in WordPress#12062.
Follow-up to r21680, r47202, r55156, r55198, r55221.
Props thisismyurl, westonruter, sabernhardt, gazipress, jamesbregenzer, manhar, sanayasir, freewebmentor.
See #57574, #41474.
Fixes #65397.
git-svn-id: https://develop.svn.wordpress.org/trunk@62494 602fd350-edb4-49c9-b593-d223f7449a821 parent c384eff commit b6a12a5
2 files changed
Lines changed: 10 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3387 | 3387 | | |
3388 | 3388 | | |
3389 | 3389 | | |
3390 | | - | |
| 3390 | + | |
3391 | 3391 | | |
3392 | 3392 | | |
3393 | 3393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4573 | 4573 | | |
4574 | 4574 | | |
4575 | 4575 | | |
4576 | | - | |
| 4576 | + | |
4577 | 4577 | | |
4578 | 4578 | | |
4579 | 4579 | | |
| |||
4679 | 4679 | | |
4680 | 4680 | | |
4681 | 4681 | | |
4682 | | - | |
| 4682 | + | |
4683 | 4683 | | |
4684 | 4684 | | |
4685 | 4685 | | |
| |||
4695 | 4695 | | |
4696 | 4696 | | |
4697 | 4697 | | |
4698 | | - | |
| 4698 | + | |
4699 | 4699 | | |
4700 | 4700 | | |
4701 | 4701 | | |
4702 | 4702 | | |
4703 | 4703 | | |
4704 | 4704 | | |
4705 | 4705 | | |
4706 | | - | |
| 4706 | + | |
| 4707 | + | |
4707 | 4708 | | |
4708 | 4709 | | |
4709 | 4710 | | |
4710 | | - | |
| 4711 | + | |
4711 | 4712 | | |
4712 | 4713 | | |
4713 | 4714 | | |
| |||
4718 | 4719 | | |
4719 | 4720 | | |
4720 | 4721 | | |
4721 | | - | |
| 4722 | + | |
4722 | 4723 | | |
4723 | 4724 | | |
4724 | 4725 | | |
| |||
4757 | 4758 | | |
4758 | 4759 | | |
4759 | 4760 | | |
4760 | | - | |
| 4761 | + | |
4761 | 4762 | | |
4762 | 4763 | | |
4763 | 4764 | | |
| |||
4766 | 4767 | | |
4767 | 4768 | | |
4768 | 4769 | | |
4769 | | - | |
| 4770 | + | |
4770 | 4771 | | |
4771 | 4772 | | |
4772 | 4773 | | |
| |||
0 commit comments