-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include $parsed_url[path] in the assessment #6995
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -653,12 +653,14 @@ function amp_get_current_url() { | |||||
if ( isset( $parsed_url['port'] ) ) { | ||||||
$current_url .= ':' . $parsed_url['port']; | ||||||
} | ||||||
$current_url .= '/'; | ||||||
|
||||||
$current_url .= '/' . trim($parsed_url['path'], '/') . '/' ; | ||||||
|
||||||
if ( isset( $_SERVER['REQUEST_URI'] ) ) { | ||||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | ||||||
$current_url .= ltrim( wp_unslash( $_SERVER['REQUEST_URI'] ), '/' ); | ||||||
$current_url .= ltrim( wp_unslash( str_replace($parsed_url['path'], '', $_SERVER['REQUEST_URI']) ), '/' ); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unslashing should be limited to the input var:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, wouldn't it be a good hardening to ensure that it only removes |
||||||
} | ||||||
|
||||||
return esc_url_raw( $current_url ); | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a site that is located at the root, wouldn't this result in
//
being appended?