mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 13:20:20 +00:00
Media: Revert [57310].
This commit reintroduced a minor data exposure issue. Props swissspidy. See #59866, #57913. git-svn-id: https://develop.svn.wordpress.org/trunk@57318 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -550,20 +550,13 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
$is_attachment_redirect = false;
|
||||
|
||||
if ( is_attachment() && ! get_option( 'wp_attachment_pages_enabled' ) ) {
|
||||
$attachment_id = get_query_var( 'attachment_id' );
|
||||
$attachment_post = get_post( $attachment_id );
|
||||
$attachment_parent_id = $attachment_post ? $attachment_post->post_parent : 0;
|
||||
$attachment_id = get_query_var( 'attachment_id' );
|
||||
|
||||
/*
|
||||
* If an attachment is attached to a post, it inherits the parent post's status. Fetch the
|
||||
* parent post to check its status later.
|
||||
*/
|
||||
if ( $attachment_parent_id ) {
|
||||
$redirect_obj = get_post( $attachment_parent_id );
|
||||
if ( current_user_can( 'read_post', $attachment_id ) ) {
|
||||
$redirect_url = wp_get_attachment_url( $attachment_id );
|
||||
|
||||
$is_attachment_redirect = true;
|
||||
}
|
||||
$redirect_url = wp_get_attachment_url( $attachment_id );
|
||||
|
||||
$is_attachment_redirect = true;
|
||||
}
|
||||
|
||||
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
|
||||
|
||||
Reference in New Issue
Block a user