Opened 9 years ago
Last modified 9 years ago
#12644 new defect
Incompatibilty with new directorystructure and sha1-naming-convention for attachments (trac v1.0),
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Component: | SearchAttachmentsPlugin |
Severity: | major | Keywords: | sha1 filename |
Cc: | Trac Release: | 1.0 |
Description (last modified by )
After some modifications to the 1.0 version of searchattachments.py
the plugin was able to perform a search in wiki- and ticket-attachments in my environment (Windows, trac 1.0).
However, the resultset of the search returns links like:
Attachment::wiki/f09/f0955265d583361233790e2a4da795373c345a9f/f82e178298c44740723b7ee0c867cadcd29ff8a2.pdf
Indeed, as per t:#10313, the path is now rather based on message-digests of meaningfull words, than on readable words.
More-over, when clicking on such a link, an error-message appears saying there's no way to link to the attachment:
No handler matched request to /attachments/wiki/f09/f0955265d583361233790e2a4da795373c345a9f/f82e178298c44740723b7ee0c867cadcd29ff8a2.pdf
An approach would be to store the hash-based path in the database, this would allow a "reverse lookup" of the correct URL.
Attachments (4)
Change History (9)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|---|
Keywords: | sha1 added; MD5 handler removed |
Severity: | blocker → major |
comment:2 Changed 9 years ago by
Summary: | Incompatibilty with new directorystructure and MD5-namingconvention for attachments (trac v1.0), → Incompatibilty with new directorystructure and sha1-naming-convention for attachments (trac v1.0), |
---|
Changed 9 years ago by
Attachment: | searchattachments.py added |
---|
comment:3 Changed 9 years ago by
jun66j5: thanks for the corrections.
In attachment a modified searchattachemnts.py
(cf. source:searchattachmentsplugin/1.0/searchattachments/searchattachments.py) which works under trac 1.0 in a Windows-environment. Modifications take into account:
- using
subprocess.Popen()
instead ofcommands.getstatusoutput()
(see #12645) - attachments-directory now is under directory named files.
comment:4 follow-up: 5 Changed 9 years ago by
Would you kindly create a patch file as described in t:TracDev/SubmittingPatches?
Also, shell=True
should be removed.
According to https://docs.python.org/2/library/subprocess.html#using-the-subprocess-module:
Warning: Using shell=True can be a security hazard. See the warning under Frequently Used Arguments for details.
Changed 9 years ago by
Attachment: | searchattachments_for_windows_and_trac_v1.diff added |
---|
patch file which makes searchattachments work with trac v1.0 under MS Windows. Not yet tested on another platform.
comment:5 Changed 9 years ago by
Replying to jun66j5:
Would you kindly create a patch file as described in t:TracDev/SubmittingPatches? ...
Pls. find attached a diff-file. Please note:
- I have not been able to provide unit-tests, nor have I been able to test in a non-windows environment.
- The code can most likely be improved (style-wise and performance-wise).
- The
No handler...
error-message in the description was caused by the use of.../attachments/...
instead of.../attachment/...
in the URL. However, when using.../attachment/...
the error-message becomes:Error: invalid attachment. Attachment 'wiki:f09/f0955265d583361233790e2a4da795373c345a9f: 4fed0572a8c466e1c654bdd27048b5c3bb1062be.PDF' does not exist.
- The author of #10219 has made several suggestions to improve this plugin. It would be nice if some skilled developer would be able to port these to a trac version > 1.0.
Changed 9 years ago by
Attachment: | trac-seat_for_windows_and_trac_v1.diff added |
---|
the trac-seat python script also needs some modifications to make it work in windows.
Changed 9 years ago by
Attachment: | trac-seat_for_windows_and_trac_v1.2.diff added |
---|
the trac-seat python script also needs some modifications to make it work in windows
modified to make it work under windows & trac 1.0 (at least in my environment).