Opened 14 years ago
Closed 14 years ago
#8466 closed defect (fixed)
wiki.getPageHTML on page with image returns empty image
Reported by: | Owned by: | osimons | |
---|---|---|---|
Priority: | high | Component: | XmlRpcPlugin |
Severity: | major | Keywords: | image url wiki_to_html |
Cc: | Trac Release: | 0.12 |
Description (last modified by )
Image attached to page as [[Image(tab1.JPG)]]
is fine in wiki, but calling getPageHTML
returns empty tag: <img />
Trac v0.12.1 TracXMLRPC v1.1.0
Attachments (0)
Change History (5)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Keywords: | url wiki_to_html added |
---|
The following patch fixes it for me (thx to comment from t:#9292).
NB: that according to the trac source, wiki_to_html
has been deprecated and format_to_html
should be used instead.
-
wiki.py
a b 14 14 from trac.resource import Resource, ResourceNotFound 15 15 from trac.wiki.api import WikiSystem 16 16 from trac.wiki.model import WikiPage 17 from trac.wiki.formatter import wiki_to_html 17 from trac.wiki.formatter import wiki_to_html, format_to_html 18 from trac.mimeview import Context 18 19 19 20 from tracrpc.api import IXMLRPCHandler, expose_rpc, Binary 20 21 from tracrpc.util import StringIO, to_utimestamp, from_utimestamp … … 94 95 def getPageHTML(self, req, pagename, version=None): 95 96 """ Return page in rendered HTML, latest version. """ 96 97 text = self.getPage(req, pagename, version) 97 html = wiki_to_html(text, self.env, req, absurls=1) 98 #html = wiki_to_html(text, self.env, req, absurls=1) 99 resource = Resource('wiki', pagename) 100 context = Context.from_request(req, resource, absurls=1) 101 html = format_to_html(self.env, context, text) 98 102 return '<html><body>%s</body></html>' % html 99 103 100 104 def getAllPages(self, req):
comment:3 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:4 follow-up: 5 Changed 14 years ago by
(In [9818]) XmlRpcPlugin: Fix for rendering wiki HTML in proper context for correct links and references to relative resources (such as image attachment reference).
Added test for absolute and relative attachment, but test only passes on Trac 0.11 - Trac 0.12 seems to have a bug here...
References #8466
comment:5 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to osimons:
Added test for absolute and relative attachment, but test only passes on Trac 0.11 - Trac 0.12 seems to have a bug here...
I stand corrected. After messing around with my development setup and re-running test switching 0.11 <-> 0.12, it has now decided to work for 0.12 as well (using latest 0.12.2 at least).
I now consider the issue fixed, but please reopen if something is still not right.
Thanks for report and patch!
Forgot to mention,
getPage
returns[[Image(tab1.JPG)]]
correctly.