Editor: Allow symlinks in directories provided to `get_block_asset_url()`.

This changeset allows using symbolic links for `editorScript` and `editorStyle` in `register_block_type()`. This adds `realpath` to template and stylesheet in `get_block_asset_url()` to ensure returning canonicalized absolute pathnames.

Follow-up to [56683].

Props antonlukin, spacedmonkey, maxpertici.
Fixes #59175.
See #58525.




Built from https://develop.svn.wordpress.org/trunk@57675


git-svn-id: http://core.svn.wordpress.org/trunk@57176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2024-02-21 09:38:12 +00:00
parent 754fa3b6f9
commit 46e8b6fc71
2 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ function get_block_asset_url( $path ) {
$template = get_template();
if ( ! isset( $template_paths_norm[ $template ] ) ) {
$template_paths_norm[ $template ] = wp_normalize_path( get_template_directory() );
$template_paths_norm[ $template ] = wp_normalize_path( realpath( get_template_directory() ) );
}
if ( str_starts_with( $path, trailingslashit( $template_paths_norm[ $template ] ) ) ) {
@ -116,7 +116,7 @@ function get_block_asset_url( $path ) {
if ( is_child_theme() ) {
$stylesheet = get_stylesheet();
if ( ! isset( $template_paths_norm[ $stylesheet ] ) ) {
$template_paths_norm[ $stylesheet ] = wp_normalize_path( get_stylesheet_directory() );
$template_paths_norm[ $stylesheet ] = wp_normalize_path( realpath( get_stylesheet_directory() ) );
}
if ( str_starts_with( $path, trailingslashit( $template_paths_norm[ $stylesheet ] ) ) ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-beta2-57674';
$wp_version = '6.5-beta2-57675';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.