Skip to content

[BUG] thumbnailAction can use wron path, if wysiwyg path was already changed #5124

@gnysek

Description

@gnysek

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I've noticed, that when changing folders in WYSIWYG "insert image" modalbox, \Mage_Adminhtml_Cms_Wysiwyg_ImagesController::contentsAction saves current browsed path to $this->_initAction()->_saveSessionCurrentPath().

However, there still can be some pending \Mage_Adminhtml_Cms_Wysiwyg_ImagesController::thumbnailAction requests (like https://magento.local/index.php/admin/cms_wysiwyg_images/thumbnail/file/<b64key>/key/<adminkey>), which from that point will try to search for images in different directory.

Because of that Mage_Cms_Model_Wysiwyg_Images_Storage::resizeFile will always return false; for them.
However, there was custom patch for SUPEE-9767 to allow upload/view PDFs after that patch named Ash_PdfUploadAfterSupee9767, and this specific file https://github.com/augustash/ash_pdfuploadaftersupee9767/blob/cd74d79f42f40782824091f68a40527a51c841a7/app/code/community/Ash/PdfUploadAfterSupee9767/Model/Rewrite/Cms/Wysiwyg/Images/Storage.php#L18 will cause to throw warnings in that case:
Warning: mime_content_type(/home/.../public/media/wysiwyg/home/<somefile.jpg>): failed to open stream: No such file or directory in /home/.....

This doesn't seem to be a big issue, I'm rather reporting it to point out that in case of Image Browser thousands of requests might be done to server, even if folder was already changed. It would be good idea, if they could be somehow queued, as it seems that no more than 21 images fits in this window at once (yet it calls for thumbnail for each image).

Expected Behavior

When using Insert Image/Insert File in WYSIWYG, don't load all thumbnails for folder at once.

Steps To Reproduce

  1. Put breakpoint in app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php:370
  2. Open Insert Image/Insert File in WYSIWYG
  3. Try to quickly change directories, go to directory root, close and open window few times
  4. Notice that at some point it would enter into return false; like file is not existing, because of another folder in session by _saveSessionCurrentPath(). This can be even few hundred of files on complex pages.

Environment

- OpenMage:
- php:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions