Replacing media on S3
-
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.
- The topic ‘Replacing media on S3’ is closed to new replies.