Opened 7 years ago
Last modified 7 years ago
#47889 new defect (bug)
uploading image contains special characters will return a wrong image url
| Reported by: | sockscap64 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Media | Version: | 5.2.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
7 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/
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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/