WPIntell

Source evidence

Doesn't handle % characters correctly

Auto Save Remote Image · support · 2012-11-03T20:05:00+00:00

mixedsentiment
mediumseverity
0.72relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 35 rows with source links

14.3% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

30 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
etchedinpixels resolved
Hi, great idea for a plugin. However, I’m having some problems using it with my Smugmug hosted images due to the way it translates % symbols in the URL. Here’s what happens. I insert an image http://etchedinpixels.smugmug.com/Things/Still-Life/i-WrrB5bg/3/M/Giant%20peach%20moktak%3F-M.jpg And the plugin uploads it to my site as http://etchedinpixels.com/blog/wp-content/uploads/2012/11/Giantpeachmoktak%3F-M.jpg However, WordPress then fails to load the image, it returns a 404. I found that the URL needs to be entered as http://etchedinpixels.com/blog/wp-content/uploads/2012/11/Giantpeachmoktak%253F-M.jpg Note that in the browser any % in the filename needs to be changed to %25 the plugin isn’t doing this when inserting the URL into the post. I’m going to see what I can do to fix the code but I barely know anything. I’ll post if I have a solution. Thanks for all the great work. http://wordpress.org/extend/plugins/auto-save-remote-images/ Hi there, I will try to fix this bug and update the plugin soon. Thanks for pointing it out. Regards, PS Thanks! I don’t know much about php but after talking with my developer friend, he suggested the URLDECODE function to convert the image filename before copying it on one’s WordPress site. It now seems to handle the %3F symbol in my smugmug image correctly. It takes the image URL http://etchedinpixels.smugmug.com/Things/Still-Life/i-WrrB5bg/3/M/Giant%20peach%20moktak%3F-M.jpg and stores the file locally as Giantpeachmoktak-M.jpg It would be nice if it also converted the %20 to ‘_’ . But the main thing is that it seemed to handle the question mark (encoded as %3F) correctly. I replaced: $mirror = wp_upload_bits( str_replace('%20', '', basename( $first_image )), '', wp_remote_retrieve_body( $get ) ); with $mirror = wp_upload_bits( urldecode(basename( $first_image )), '', wp_remote_retrieve_body( $get ) ); Prebhdev, would you mind telling me if I implemented this correctly and it’s working for you too? Hi there, Your friend is correct. I have uploaded new copy of the plugin which fixes this issue. Instead of using urldecode, I’m instead using rawurldecode. This should take care of the problem with % signs in filenames.

Comments

3 shown
prebhdevsingh 2012-11-05T21:06:00+00:00

Hi there, I will try to fix this bug and update the plugin soon. Thanks for pointing it out. Regards, PS

etchedinpixels 2012-11-05T21:43:00+00:00

Thanks! I don’t know much about php but after talking with my developer friend, he suggested the URLDECODE function to convert the image filename before copying it on one’s WordPress site. It now seems to handle the %3F symbol in my smugmug image correctly. It takes the image URL http://etchedinpixels.smugmug.com/Things/Still-Life/i-WrrB5bg/3/M/Giant%20peach%20moktak%3F-M.jpg and stores the file locally as Giantpeachmoktak-M.jpg It would be nice if it also converted the %20 to ‘_’ . But the main thing is that it seemed to handle the question mark (encoded as %3F) correctly. I replaced: $mirror = wp_upload_bits( str_replace('%20', '', basename( $first_image )), '', wp_remote_retrieve_body( $get ) ); with $mirror = wp_upload_bits( urldecode(basename( $first_image )), '', wp_remote_retrieve_body( $get ) ); Prebhdev, would you mind telling me if I implemented this correctly and it’s working for you too?

prebhdevsingh 2012-11-08T23:48:00+00:00

Hi there, Your friend is correct. I have uploaded new copy of the plugin which fixes this issue. Instead of using urldecode, I’m instead using rawurldecode. This should take care of the problem with % signs in filenames.