Skip to content

Commit

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

Fix the validate_file error on Windows
  • Loading branch information
stevenslack authored Dec 12, 2023
2 parents b339f80 + 9a08066 commit fed3c9d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `WP Curate` will be documented in this file.

## 1.4.5 - 2023-12-12

- Bug fix: Adds support to Windows file path validation with `validate_file` function.

## 1.4.4 - 2023-12-04

- Bug fix: Update to the `Parsed_Block` new namespace.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"license": "GPL-2.0-or-later",
"main": "wp-curate.php",
"engines": {
"node": "18",
"npm": "9"
"node": ">=18",
"npm": ">=9"
},
"browserslist": [
"defaults",
Expand Down
4 changes: 2 additions & 2 deletions src/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function action_enqueue_block_editor_assets(): void {
* @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 @@ -173,7 +173,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
2 changes: 1 addition & 1 deletion wp-curate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Curate
* Plugin URI: https://github.com/alleyinteractive/wp-curate
* Description: Plugin to curate homepages and other landing pages
* Version: 1.4.4
* Version: 1.4.5
* Author: Alley Interactive
* Author URI: https://github.com/alleyinteractive/wp-curate
* Requires at least: 6.3
Expand Down

0 comments on commit fed3c9d

Please sign in to comment.