#1802 closed defect (fixed)
attachment link on WikiStart page
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | wiki system | Version: | devel |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal 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 (0)
Change History (5)
comment:1 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Priority: | normal → high |
Severity: | normal → minor |
Status: | new → assigned |
comment:2 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → 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 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Instead of this admitted kludge, why not simply send a redirect to the WikiStart page when no Wiki page is specified.
comment:4 by , 19 years ago
Milestone: | 0.9 |
---|---|
Owner: | removed |
Priority: | high → normal |
Status: | reopened → new |
Well, I see that this would solve the issue for links like:
but not for links like:
comment:5 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Resolution: | → fixed |
Status: | new → 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.