Open brucealdridge opened 17 hours ago
9788
or branch name fix/7399
in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments :rocket: Launch a JN site with this branch :rocket:
:information_source: Install this Tampermonkey script to get more options.
Build info:
Note: the build is updated when a new commit is pushed to this PR.
Size Change: 0 B
Total Size: 1.33 MB
✅ Visit the WC Order page, confirm that the note is rendering the link correctly
/wp-admin/admin.php?page=wc-admin&path=%2Fpayments%2Ftransactions%2Fdetails&id=ch_3xxxxxG
URL renders with encoded params and on clicking opens the correct dispute details too.
✅ View the raw order note in the database column wp_comments.comment_content to confirm.
The same URL appears in the comment content within the DB too.
Fixes #7399
Changes proposed in this Pull Request
URLs to disputes in order notes are rendered incorrectly. Any
/
characters inside the query string should be encoded as%2F
This PR ensures that the
path
attribute in the query string is URL-encoded correctly.Implementation Notes
Passing a correctly encoded URL to
WC_Payments_Utils::esc_interpolated_html()
alters the URL to replace%2F
with0.000000
.I looked at the possibility of updating this function but couldn't see where it was going wrong. I reviewed the code and found that links to disputes and transactions (issue created) are the only cases where this is affected.
Surprisingly, the WP function
add_query_arg
doesn’t sanitize or encode the provided values.I was going to use
urlencode
but phpcs recommendsrawurlencode
instead.Testing instructions
4000000000000259
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge