Skip to content

Commit

Permalink
Add basic validation to enclosure function (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle authored Nov 30, 2024
1 parent f2021ec commit e8e8706
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improved

* Basic enclosure validation
* More User -> Actor renaming
* Outsource Constants to a separate file
* Better handling of `readme.txt` and `README.md`
Expand Down
5 changes: 5 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,11 @@ function get_enclosures( $post_id ) {

$enclosures = array_map(
function ( $enclosure ) {
// Check if the enclosure is a string.
if ( ! $enclosure || ! is_string( $enclosure ) ) {
return false;
}

$attributes = explode( "\n", $enclosure );

if ( ! isset( $attributes[0] ) || ! \wp_http_validate_url( $attributes[0] ) ) {
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ For reasons of data protection, it is not possible to see the followers of other
* Added: Fediverse Preview on post-overview page
* Added: GitHub action to enforce Changelog updates
* Added: New contributors
* Improved: Basic enclosure validation
* Improved: More User -> Actor renaming
* Improved: Outsource Constants to a separate file
* Improved: Better handling of `readme.txt` and `README.md`
Expand Down

0 comments on commit e8e8706

Please sign in to comment.