Skip to content

Commit a95eeb8

Browse files
fix: properly escape some strings
1 parent 697b540 commit a95eeb8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/rest-api/class-rest-editor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function register_route() {
6565
public static function validate_string( $value, $request, $param ) {
6666
if ( ! is_string( $value ) ) {
6767
// Translators: %s is the parameter name.
68-
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'interactions' ), $param ) );
68+
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'interactions' ), esc_html( $param ) ) );
6969
}
7070
return true;
7171
}
@@ -79,12 +79,12 @@ public static function validate_interaction( $value, $request, $param ) {
7979
$data = json_decode( $value );
8080
if ( ! $data ) {
8181
// Translators: %s is the parameter name.
82-
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a valid JSON string.', 'interactions' ), $param ) );
82+
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a valid JSON string.', 'interactions' ), esc_html( $param ) ) );
8383
}
8484

8585
$result = Interact_Interaction::validate_interaction_data( $data );
8686
if ( is_wp_error( $result ) ) {
87-
return $is_valid;
87+
return $result;
8888
}
8989

9090
return true;

src/rest-api/class-rest-location-rules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function register_route() {
3838
public static function validate_string( $value, $request, $param ) {
3939
if ( ! is_string( $value ) ) {
4040
// Translators: %s is a placeholder for a parameter name.
41-
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'interactions' ), $param ) );
41+
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'interactions' ), esc_html( $param ) ) );
4242
}
4343
return true;
4444
}

0 commit comments

Comments
 (0)