Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1496265
    Adam Golden
    Guest

    Bug Report, I don’t need support or help.

    Description:
    The filesize column added by avia_media_gallery in class-media.php displays a stale file size when an attachment’s underlying file has been replaced or converted after upload.

    Steps to reproduce:
    1. Upload a JPEG or PNG image
    2. Programmatically convert it to WEBP or AVIF — update _wp_attached_file postmeta to point to the new file, update _wp_attachment_metadata[‘file’] and _wp_attachment_metadata[‘filesize’], update post_mime_type, and delete the original file
    3. Visit wp-admin/upload.php in list view
    4. The filesize column shows the original file’s size, not the converted file’s size

    Expected: The column shows the size of the current file on disk, as returned by filesize( get_attached_file( $post_id ) )
    Actual: The column shows a stale size — the original file no longer exists on disk, yet the old size is displayed
    Cause: avia_media_gallery appears to cache or calculate the file size at upload time rather than reading it fresh at render time, or reads from a stale source that isn’t updated when the attachment file is replaced.
    Verified: get_attached_file( $post_id ) returns the correct new file path, the file exists on disk, and filesize() on that path returns the correct size. WordPress core’s _wp_attachment_metadata[‘filesize’] is also correct. The issue is specific to Enfold’s column rendering.
    Workaround: Hooking manage_media_custom_column at priority 20 and replacing the output with a direct filesize( get_attached_file() ) call produces the correct value.

    #1496324

    Hey,

    Thank you for the detailed bug report. We will forward the issue to our channel.

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.