mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@57675 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
75eb1a86e9
commit
4ba0963a1f
@ -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 ] ) ) ) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user