Skip to content
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

Fixes #26010 - Template Part Not Found message on Windows server #26772

Merged
merged 8 commits into from
Nov 26, 2020
2 changes: 1 addition & 1 deletion packages/block-library/src/template-part/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function render_block_core_template_part( $attributes ) {
// Else, if the template part was provided by the active theme,
// render the corresponding file content.
$template_part_file_path = get_stylesheet_directory() . '/block-template-parts/' . $attributes['slug'] . '.html';
if ( 0 === validate_file( $template_part_file_path ) && file_exists( $template_part_file_path ) ) {
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what's the purpose of this validate_file call? Why not just remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to stop directory traversal.

$content = file_get_contents( $template_part_file_path );
}
}
Expand Down