Skip to content

Commit

Permalink
Merge pull request #92 from rinatkhaziev/fix/infinite-loop
Browse files Browse the repository at this point in the history
1.3.4
  • Loading branch information
rinatkhaziev authored Jan 26, 2022
2 parents ac8f408 + b697c52 commit 39a5907
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions frontend-uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Frontend Uploader
Description: Allow your visitors to upload content and moderate it.
Author: Rinat Khaziev, Daniel Bachhuber
Version: 1.3.3
Version: 1.3.4
Author URI: https://rinat.dev/
Text Domain: frontend-uploader
Requires at least: 4.6
Expand All @@ -28,7 +28,7 @@
*/

// Define consts and bootstrap and dependencies
define( 'FU_VERSION', '1.3.3' );
define( 'FU_VERSION', '1.3.4' );
define( 'FU_ROOT' , dirname( __FILE__ ) );
define( 'FU_FILE_PATH' , FU_ROOT . '/' . basename( __FILE__ ) );
define( 'FU_URL' , plugins_url( '/', __FILE__ ) );
Expand Down Expand Up @@ -155,7 +155,9 @@ function _set_language() {
*/
function _get_mime_types() {
// $mime_types_orig is needed to re-map the values from the settings lib structure to core WP extension regex => mime-type format.
remove_filter( 'upload_mimes', [ $this, '_get_mime_types' ], 999 );
$mime_types = $mime_types_orig = get_allowed_mime_types();
add_filter( 'upload_mimes', [ $this, '_get_mime_types' ], 999 );

$enabled = isset( $this->settings['enabled_files'] ) && is_array( $this->settings['enabled_files'] ) && $this->settings['enabled_files'] ? $this->settings['enabled_files'] : $mime_types;

Expand All @@ -172,6 +174,7 @@ function _get_mime_types() {

unset( $enabled['htm|html'] );
unset( $enabled['js'] );
unset( $enabled['svg|svgz'] );

/**
* Configuration filter: fu_allowed_mime_types should return array of allowed mime types (see readme)
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: frontend, image, images, media, uploader, upload, video, audio, photo, pho
Requires at least: 4.6
Requires PHP: 7.2
Tested up to: 5.9
Stable tag: 1.3.3
Stable tag: 1.3.4
License: GPLv2 or later

This plugin allows your visitors to upload User Generated Content (media and posts/custom-post-types with media).
Expand Down Expand Up @@ -400,6 +400,9 @@ function my_fu_upload_result( $layout, $result ) {

== Changelog ==

= 1.3.4 (Jan 26, 2022) =
* Bugfix: the new allow type logic resulted in an infinite loop in some cases

= 1.3.3 (Aug 28, 2021) =
* Re-worked the way file type allow list works
* Readme formatting updates to hopefully make it clearer
Expand Down

0 comments on commit 39a5907

Please sign in to comment.