Ticket #1802 (closed defect: fixed)
Opened 7 years ago
Last modified 7 years ago
attachment link on WikiStart page
| Reported by: | Shun-ichi Goto <gotoh@…> | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9 |
| Component: | wiki system | Version: | devel |
| Severity: | minor | Keywords: | |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
When I accessing WikiStart page without explicit wiki pagename like:
http://trac.my.local.net/trac or http://trac.my.local.net/trac/wiki,
the rendering of attachment link for current page (like [attachment:file text])
will cause "Index out of range" exception at attachment.py:456.
I made temporary fix for myself as bellow, but I don't know right way to fix.
--- attachment.py (revision 1986)
+++ attachment.py (working copy)
@@ -452,8 +452,9 @@
# FIXME: the formatter should know to which object belongs
# the text being formatted
# (this info will also be required for TracCrossReferences)
- path_info = formatter.req.path_info.split('/',2)
- parent_type, parent_id = path_info[1], path_info[2] # Kludge for now
+ path_info = formatter.req.path_info.split('/',2) + [None, None]
+ parent_type = path_info[1] or 'wiki'
+ parent_id = path_info[2] or 'WikiStart'
filename = link
try:
attachment = Attachment(self.env, parent_type, parent_id, filename)
(I'm using r1986)
Attachments
Change History
comment:1 Changed 7 years ago by cboos
- Milestone set to 0.9
- Owner changed from jonas to cboos
- Priority changed from normal to high
- Severity changed from normal to minor
- Status changed from new to assigned
comment:2 Changed 7 years ago by cboos
- Resolution set to fixed
- Status changed from assigned to closed
I applied your patch in r1998.
In the future, the Formatters will know to which Trac object
the wiki text to be formatted belongs, and then this code
will be cleaned-up.
comment:3 Changed 7 years ago by mgood
- Resolution fixed deleted
- Status changed from closed to reopened
Instead of this admitted kludge, why not simply send a redirect to the WikiStart page when no Wiki page is specified.
comment:4 Changed 7 years ago by cboos
- Milestone 0.9 deleted
- Owner cboos deleted
- Priority changed from high to normal
- Status changed from reopened to new
Well, I see that this would solve the issue for links like:
but not for links like:
comment:5 Changed 7 years ago by cmlenz
- Milestone set to 0.9
- Resolution set to fixed
- Status changed from new to closed
I think the fix applied here is good enough for now.
If we started redirecting, we'd also need to redirect requests to the main page to the default module, as cboos points out, and that's kind of ugly IMHO.



Yes, that was an oversight.