Skip to content

Commit e8e8706

Browse files
authored
Add basic validation to enclosure function (#1028)
1 parent f2021ec commit e8e8706

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Improved
1919

20+
* Basic enclosure validation
2021
* More User -> Actor renaming
2122
* Outsource Constants to a separate file
2223
* Better handling of `readme.txt` and `README.md`

includes/functions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,11 @@ function get_enclosures( $post_id ) {
10061006

10071007
$enclosures = array_map(
10081008
function ( $enclosure ) {
1009+
// Check if the enclosure is a string.
1010+
if ( ! $enclosure || ! is_string( $enclosure ) ) {
1011+
return false;
1012+
}
1013+
10091014
$attributes = explode( "\n", $enclosure );
10101015

10111016
if ( ! isset( $attributes[0] ) || ! \wp_http_validate_url( $attributes[0] ) ) {

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ For reasons of data protection, it is not possible to see the followers of other
138138
* Added: Fediverse Preview on post-overview page
139139
* Added: GitHub action to enforce Changelog updates
140140
* Added: New contributors
141+
* Improved: Basic enclosure validation
141142
* Improved: More User -> Actor renaming
142143
* Improved: Outsource Constants to a separate file
143144
* Improved: Better handling of `readme.txt` and `README.md`

0 commit comments

Comments
 (0)