Opened 13 years ago
Closed 13 years ago
#3697 closed defect (bug) (fixed)
bp_blogs_record_post() not stripping caption shortcode correctly
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | has-patch needs-testing 2nd-opinion |
Cc: |
Description
Steps to reproduce:
- Create new post
- First thing in the post, insert an image. Make sure it has a caption, and is NOT a link to anything.
- Publish
- Look at activity stream. The excerpt has the caption shortcode closer leaking through.
Attachments (1)
Change History (8)
#2
@
13 years ago
- Keywords has-patch needs-testing 2nd-opinion added
One kinda crummy fix is, in bp_activity_thumbnail_content_images(), to replace the old image tags with a space character.
Another is to rewrite that regex so that the optional [caption] shortcodes are stripped as well. See 01.patch. It's off the top of my head and I am crummy at regex, so please examine carefully.
#3
@
13 years ago
I've implemented the patch and it solves the problem as far as I can tell. Might need double checking as I'm not a developer but the issue has stopped with the patch applied. Thanks :)
#4
@
13 years ago
- Milestone changed from 1.5.2 to 1.6
I've tested it again, and it seems to be working fine, so I'm going to go ahead with it.
Moving to 1.6 as this is not a regression.
OK, I've traced down the problem, but don't have a fix yet.
In bp_blogs_record_activity(), the activity content is piped through bp_activity_thumbnail_content_images(), which strips inline images and appends a single inline image, taken from the post, right at the front of the activity item. But the method we're using isn't checking for the presence of the [caption] shortcode. As a result, the image is successfully being pulled out of the shortcode, but the shortcode is being left with no content. As a result, the regex in strip_shortcodes() is failing (because it requires .+? instead of .*?)