Theme Editor: Validate files are editable based on their relative filenames, rather than full file path.

This fixes theme editing on Windows platforms where `validate_file()` will return `2` on a full file path.

Fixes #42609.


git-svn-id: https://develop.svn.wordpress.org/trunk@42244 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2017-11-27 03:27:19 +00:00
parent 76f77416d6
commit 6e0ba7864f
1 changed files with 2 additions and 1 deletions

View File

@ -445,7 +445,8 @@ function wp_edit_theme_plugin_file( $args ) {
}
}
if ( 0 !== validate_file( $real_file, $allowed_files ) ) {
// Compare based on relative paths
if ( 0 !== validate_file( $file, array_keys( $allowed_files ) ) ) {
return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) );
}