Opened 19 years ago
Closed 19 years ago
#3108 closed defect (fixed)
Image Macro fails to render with certain parameters
Reported by: | jeremy at slappy . org | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | wiki system | Version: | 0.9.5 |
Severity: | normal | Keywords: | image macro |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Certain macro image formatting options seem to have broken with 0.9.5. To reproduce:
- Attach an image called picture.jpg to a Wiki page
- Edit the wiki page to include the following macro:
[[Image(picture.jpg, 30%)]]
- Preview the new wiki page
- An error message should appear as follows:
- Error: Macro Image(picture.jpg, 30%) failed
- Not enough arguments for format string
Attachments (1)
Change History (7)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Version: | 0.9.5 |
---|
by , 19 years ago
Attachment: | escape-percent-image-macro.diff added |
---|
Patch for ImageMacro with '%' symbol in the attributes.
comment:3 by , 19 years ago
The patch above escape the '%' symbol in the img_attr string so the Markup class don't try to substitute it.
Works for me in a 0.9.5 (Debian version, I think) installation of Trac.
Don't know if the bug rises in other macros, but it should be as simple as this patch to fix them.
comment:4 by , 19 years ago
Milestone: | → 0.10 |
---|---|
Version: | → 0.9.5 |
I have this problem on Windows too since I installed 0.9.5. I just patched the file and now it works.
Note: I inserted the line
img_attr = img_attr.replace('%', '%%') # line 355
at line 355 and not at line 346 as shown in the diff (don't know if it's important, only to be precise)
The code now looks like:
img_attr += ' style="%s"' % img_style # line 354 img_attr = img_attr.replace('%', '%%') # line 355 result = Markup('<img src="%%s" %s />' % img_attr, raw_url).sanitize()
Conclusion:
- I confirm the existence of this bug
- I would like to see this very small patch in the next version.
Excuse me if I set the version to 0.9.5, and the milestone to 0.10 but it's so a small patch :-)
comment:5 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I'll take care of this one.
comment:6 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
A couple more comments: