Skip to content

Commit

Permalink
Merge pull request #297 from alleyinteractive/hotfix/support-windows-…
Browse files Browse the repository at this point in the history
…path

Support windows path in validate_file checks
  • Loading branch information
stevenslack authored Dec 12, 2023
2 parents 72e3138 + 8394367 commit d29cef4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @return bool True if the path is valid and the file exists.
*/
function validate_path( string $path ): bool {
return 0 === validate_file( $path ) && file_exists( $path );
return ( 0 === validate_file( $path ) || 2 === validate_file( $path ) ) && file_exists( $path );
}

/**
Expand Down Expand Up @@ -119,7 +119,7 @@ function load_scripts(): void {

if ( ! empty( $files ) ) {
foreach ( $files as $path ) {
if ( 0 === validate_file( $path ) && file_exists( $path ) ) {
if ( validate_path( $path ) ) {
require_once $path; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile, WordPressVIPMinimum.Files.IncludingFile.UsingVariable
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ function register_meta_helper(
function register_post_meta_from_defs(): void {
// Ensure the config file exists.
$filepath = dirname( __DIR__ ) . '/config/post-meta.json';
if ( ! file_exists( $filepath )
|| 0 !== validate_file( $filepath )
) {
if ( ! validate_path( $filepath ) ) {
return;
}

Expand Down

0 comments on commit d29cef4

Please sign in to comment.