From 33b742f7d153e620edbb1e88a2d56cbded8134dd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 10 May 2018 21:11:00 +0000 Subject: [PATCH] Privacy: Normalize file paths in `wp_privacy_generate_personal_data_export_file()` to make sure Windows paths don't have their backslashes stripped. Props xkon, pmbaldha. Fixes #43908. git-svn-id: https://develop.svn.wordpress.org/trunk@43234 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 9a89114675..17a51b8d40 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -2048,7 +2048,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $obscura = wp_generate_password( 32, false, false ); $file_basename = 'wp-personal-data-file-' . $stripped_email . '-' . $obscura; $html_report_filename = $file_basename . '.html'; - $html_report_pathname = $exports_dir . $html_report_filename; + $html_report_pathname = wp_normalize_path( $exports_dir . $html_report_filename ); $file = fopen( $html_report_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to open export file (HTML report) for writing.' ) ); @@ -2144,7 +2144,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $archive_url = $exports_url . $archive_filename; update_post_meta( $request_id, '_export_file_url', $archive_url ); - update_post_meta( $request_id, '_export_file_path', $archive_pathname ); + update_post_meta( $request_id, '_export_file_path', wp_normalize_path( $archive_pathname ) ); } if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) {