Opened 5 years ago
Last modified 5 years ago
#47889 new defect (bug)
uploading image contains special characters will return a wrong image url
Reported by: | sockscap64 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.2.2 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
How to reproduce this bug?
1> ready an image, make sure it contains a special character, such as ^
. In my case, this image file is test^image.jpg
2> goto page 'Upload New Media', that is './wp-admin/media-new.php'
3> select your image file and upload it.
4> in the completion list, you will see a thumbnail and the image that you uploaded. (see attachment )
5> the thumbnail is broken, and the URL of the thumbnail is '.../testimage.jpg'
. actually, it's should be '.../test^image.jpg'
Attachments (2)
Change History (5)
#3
in reply to:
↑ 2
@
5 years ago
Thank you so much.@donmhico
Replying to donmhico:
Hello @sockscap64,
Welcome to our trac. Thank you for your bug report. I confirmed the bug on my side as well and I attached a patch that fixes it.
In my attached patch, 47889.diff, you'll see that I removed the wrapping
esc_url()
. I think it's safe to do this since the image url comes fromwp_get_attachment_image_src()
which is expected to return an array with a url as the first element if the image exist.
Reference:
https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/
Hello @sockscap64,
Welcome to our trac. Thank you for your bug report. I confirmed the bug on my side as well and I attached a patch that fixes it.
In my attached patch, 47889.diff, you'll see that I removed the wrapping
esc_url()
. I think it's safe to do this since the image url comes fromwp_get_attachment_image_src()
which is expected to return an array with a url as the first element if the image exist.Reference:
https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/