• Images with a valid file type (e.g. PNG – Mime type ‘image/png’) and a not lowercase version of the extension (e.g. ‘image.PNG’ instead of ‘image.png’) are not handled correctly.

    They are not considered images (even though they are) purely due to the fact that the extension is not fully lowercase. Therefore, in the rich text editor, it is not added as img. Consequently, the image is also not being moved/stored correctly in the final location (‘anspress-uploads’) and the temporary storage location (‘anspress-temp’) is not replaced for the img src.

    lib/form/class-upload.php contains code that constructs a $new_file_name based on the original file extension (see here).

    However, includes/upload.php contains code that determines if a file is an image based on the (original) extension (see here). is_image is then incorrectly set to false as a result (with all the consequences as described above).

    I noticed a comment in the code (see here) that the code responsible for uploading the file was copied from WordPress Core. However, I don’t think this is up to date anymore. It should simply be uploaded with a normalized filename. Just as is done here through $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); (see also Inserting images into posts and pages). Then this problem could not occur in the first place since there is simply no possibility of adding different versions of casing of the same extension.

    This is a serious problem because users upload images that are permanently lost. I would like to see this resolved, as I understand this is something the plugin is supposed to fix.

    Note that this is something going on recently because of this change (Apr 17, 2024).

  • You must be logged in to reply to this topic.