• robertpalmerdptr

    (@robertpalmerdptr)


    Hello! We’re having an issue with using this plugin with the Human Made S3 Uploads plugin (https://github.com/humanmade/S3-Uploads). Users cannot replace media, and the problem appears to be with the function getNewTargetLocation in classes/Controller/ReplaceController.php.

    On lines 543 and 544, you’re using realpath to identify the path of the file and make sure it exists — the problem is that our path is on S3, and looks like s3://mybucket/uploads, which doesn’t map to a directory on the server. realpath in that instance returns false, and the test on line 547 triggers an ERROR_DIRECTORY_SECURITY error, and the user gets a message that reads:

    An error occured
    Specificed directory is outside the upload directory. This is not allowed for security reasons

    (Separately and less importantly, the word “specified” is misspelled.)

    In future versions, would it be possible to test the result of realpath to make sure it’s not false, and if it is false, test the $realPath and $basedir variables without passing them through the realpath function?

    Thanks in advance for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Pedro

    (@petredobrescu)

    Hello @robertpalmerdptr,

    Thanks for providing all these details. Indeed, Enable Media Replace (EMR) is only compatible with WP Offload Media and not with S3 Uploads (yet!). We do have support for this plugin in our other plugin – ShortPixel Image Optimizer and we can look into porting the implementation into EMR. Would you be willing to assist us with testing it on a staging/development copy of your environment, when the time comes?

    Thank you!

    Thread Starter robertpalmerdptr

    (@robertpalmerdptr)

    I’d be happy to help! Please feel free to email [email protected] with details when you have them. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Replacing media on S3’ is closed to new replies.