Plugin incorrectly references uploads directory

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Plugin incorrectly references uploads directory

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 4 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17032
    oloftus
    oloftus
    Participant

    On websites where WordPress is run in it’s own directory and the upload directory is outside of this directory, the call to

    wd_asp()->upload_path

    on line on line 441 of wp-content/plugins/ajax-search-pro/includes/classes/core/class-asp-init.php incorrectly returns the path of the uploads directory as if it still was in the wordpress directory. E.g.

    Directory structure

    • wordpress (contains WordPress installation)
    • uploads (uploads directory)

    The call to

    wd_asp()->upload_path

    returns wordpress/uploads but should return uploads.

    #17037
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    That constant is defined in the ajax-search-pro\includes\classes\core\class-asp-manager.php file within this function:

    As you can see the upload directory is requested through wp_upload_dir() call, which refers _wp_uploads_dir(), and should always return the correct upload directory.

    Is this not the correct way? Please let me know, I am not too familiar with these modifications myself.

    Also, from what I can see in these docs, if the UPLOADS constant is set in the wp-config.php file, the wp_upload_dir() will return that url relative to the ABSPATH constant. You might need to set that constant as well, I am not sure.

    Let me know!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #17046
    oloftus
    oloftus
    Participant

    Hi Ernest,

    Thanks for your quick response and for looking into this for me. You’re quite right, the UPLOADS constant ends up being prefixed with ABSPATH- that’s something I hadn’t noticed and unfortunately something I can’t change without modifying the core.

    A workaround I have now found is to set the UPLOADS constant to “../media”. Although this does generate links like e.g. http://domain.com/../media/mypicture.jpg this is not serious in my case.

    You can close this ticket as the issue is now resolved.

    Thanks again,

    Oli

    #17047
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.