Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9292 closed defect (worksforme)

mimeview api format_to_html strips image url

Reported by: nzoltan@… Owned by:
Priority: normal Milestone:
Component: general Version: 0.12dev
Severity: normal Keywords:
Cc: nzoltan@… Branch:
Release Notes:
API Changes:

Description

The format_to_html in mimeview api strips img urls, when images attached and embedded with Image macro. URLs fine, when embedded image url are outside links.

Here is a simple Wiki page:

= test page =

This is an image: [[Image(whatever.png)]]

Then the result of format_to_html is:

<h1 id="testpage">test page</h1>
<p>
This is an image: <a style="padding:0; border:none"><img /></a>
</p> 

Attachments (0)

Change History (5)

comment:1 by nzoltan@…, 9 years ago

Cc: nzoltan@… added

comment:2 by Christian Boos, 9 years ago

The context parameter to format_to_html needs to be properly set up, in particular it should specify the .resource to which the wiki text you're formatting is belonging to.

This is important so that relative links can be correctly expanded and, as in your example, that attachments can be found (Image(whatever.png) means whatever.png is the name of a file attached to the current resource).

comment:3 by nzoltan@…, 9 years ago

Thank you very much! On the basis of this pointer I solved this problem with success. :)

- context = Context.from_request(req, absurls=False)
+ resource = Resource('wiki', pagename)
+ context = Context.from_request(req, resource, absurls=False)

comment:4 by nzoltan@…, 9 years ago

Resolution: fixed
Status: newclosed

comment:5 by Christian Boos, 9 years ago

Resolution: fixedworksforme

Perfect! I know it's not always easy to know if you've hit a bug or you're simply not using the API correctly (especially when there's no API doc, as for this one, my bad), but in any case it's sometimes faster to ask on the Trac-dev MailingList.

As for this ticket, the resolution fixed is reserved to the case some actual changes needed to be made in the repository.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.