mansj / enable-media-replace

***DEVELOPMENT DISCONTINUED*** Enable Media Replace, a WordPress plugin to make it possible to replace uploaded media files in a simple way.
GNU General Public License v2.0
28 stars 27 forks source link

Plugin does not work with stream wrappers for media held off the filesystem. #31

Open philipowen opened 7 years ago

philipowen commented 7 years ago

We us an Amazon S3 storage plugin that stores all the media in an S3 bucket. This means that the files are referred to as s3://bucket/folder/file. Line 206 of upload.php is doing a replace on double forward slashes to convert to a single one, which breaks the protocol handler detection and causes the plugin to fail. Commenting out that line makes the plugin work correctly for files of the format protocol://foo/bar.

I'm happy to put a PR up, but wanted to know the best way to address this. It isn't obvious to me what case that replace is covering, but it is clearly there for a reason. Would it be okay to only run that replace where the // isn't preceded by a :? Or is there some better logic?

Many thanks.

tomtoday commented 6 years ago

I am evaluating this plugin for our site and we, too, use S3 (via the humanmade S3-Upload plugin). Any word on a fix for this?

philipowen commented 6 years ago

You can try the fix that I used but I was hoping to hear something here before creating a PR.

tomtoday commented 6 years ago

Thanks! I'll give that a try.

FWIW, I am very impressed with the frequency at which @mansj updates this code. I appreciate your work and effort.