#6403 closed defect (fixed)
Preview feature is broken: inlined images are missing
Reported by: | Emmanuel Blot | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | attachment | Version: | devel |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Using Trac 0.11dev-r6230
When a wiki page contains some [[Image()]] macros, the image links are invalid.
The resulting preview shows only the wiki text, with image placeholders - that actually depend on how the browser renders the missing image links.
It seems the error is due to the version management of the page:
- In plain mode, image links are unversionned, such as in
<img src="/project/raw-attachment/wiki/PageName/image.png" />
- In preview/edit mode, image links are "versionned": the wiki page name part of the link contains the version of the page, such as in
<img src="/project/raw-attachment/wiki/PageName%3Fversion%3D4/image.png" />
Attachments (0)
Change History (9)
comment:1 by , 17 years ago
Description: | modified (diff) |
---|---|
Summary: | Preview feature is broken: inlined image are missing → Preview feature is broken: inlined images are missing |
comment:2 by , 17 years ago
Component: | wiki → attachment |
---|
follow-up: 4 comment:3 by , 17 years ago
Maybe. But I think it's perhaps better in this case to fix the wiki preview as well, e.g.
-
trac/wiki/web_ui.py
diff --git a/trac/wiki/web_ui.py b/trac/wiki/web_ui.py
a b class WikiModule(Component): 132 132 if action == 'edit' and not has_collision: 133 133 self._do_save(req, versioned_page) 134 134 else: 135 return self._render_editor(req, versioned_page, action, 136 has_collision) 135 return self._render_editor(req, page, action, has_collision) 137 136 elif action == 'delete': 138 137 self._do_delete(req, versioned_page) 139 138 elif action == 'diff':
comment:4 by , 17 years ago
Replying to cboos:
Maybe. But I think it's perhaps better in this case to fix the wiki preview as well, e.g.
Agreed. As long as Trac is not able to manage versions of attached files, I don't see any reason to provide the versioned_page info.
osimons, I'm not sure if you were asking me or cboos to reassign the ticket. Feel free to get the ownership.
comment:5 by , 17 years ago
Owner: | changed from | to
---|
Nothing wrong with the preview - except that is works with faulty data. This solves it as far as i can see.:
-
trac/attachment.py
483 483 if format == 'raw': 484 484 kwargs.pop('format') 485 485 prefix = 'raw-attachment' 486 parent_href = get_resource_url(self.env, resource.parent, Href('')) 486 parent_href = get_resource_url(self.env, resource.parent(version=None), 487 Href('')) 487 488 if not resource.id: 488 489 return href(prefix, parent_href) + '/' 489 490 else:
comment:6 by , 17 years ago
If solving this through attachment, #6375 is kind of related - showing problem with spaces and quoting (in addition to appending version as well).
comment:7 by , 17 years ago
comment:8 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
When building attachment support for my blog plugin, I noticed the same behavior. Understanding that the attachment module doesn't support versioned resources, I basically sent in resources with
id=None
.Now, seeing this issue, it makes me think this is better resolved in the Attachment module - by having that strip off the version element when dealing with resources, particularly when constructing URLs as it uses the resource path as basis for path on disk.
There will be a lot of these resource descriptors flying around, so Attachment should handle them appropriately by never including
...?version=nn
in filename. I certainly don't foresee us saving Attachments by both page and version, so ignoring version would be the easy alternative.I can look into this if you like, as I think I pretty much know where and how. If so, just reassign it to me and I'll pick it up.