Skip to content

Commit 21c5f65

Browse files
committed
fix(Icon): remove src path from candidates
1 parent 4ec21e4 commit 21c5f65

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

‎inc/Services/Icon.php‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,20 @@ private function resolve_icons_directory( string $source_subdir ): ?string {
140140
return null;
141141
}
142142

143-
$candidates = [
144-
get_theme_file_path( 'dist/images/' . $source_subdir ),
145-
get_theme_file_path( 'src/img/icons/' . $source_subdir ),
146-
];
143+
$icons_directory = get_theme_file_path( 'dist/images/' . $source_subdir );
147144

148-
foreach ( $candidates as $candidate ) {
149-
if ( ! is_dir( $candidate ) ) {
150-
continue;
151-
}
145+
if ( ! is_dir( $icons_directory ) ) {
146+
return null;
147+
}
152148

153-
$real_path = realpath( $candidate );
149+
$real_path = realpath( $icons_directory );
150+
$real_base = realpath( get_theme_file_path( 'dist/images' ) );
154151

155-
if ( false !== $real_path ) {
156-
return $real_path;
157-
}
152+
if ( false === $real_path || false === $real_base || ! str_starts_with( $real_path, $real_base ) ) {
153+
return null;
158154
}
159155

160-
return null;
156+
return $real_path;
161157
}
162158

163159
/**

0 commit comments

Comments
 (0)