Through a little bit of code reading... here's a handy trick. Say you
have two pages (page1 and page2) and you've attached a file with the
same name to each (redsquare.png). Here's a way you can find out the
file paths in the trac environment directory.

Filename hash:
echo -n "redsquare.png" | shasum

Page name (path) hash:
echo -n "page2" | shasum

Putting them together into the path of the file (redsquare.png on page1:
common part - files/attachments/wiki/
first 3 chars of page name hash - 060/
page name hash - 06031205beb002ab775c3037c25b3094fbd9f7f5/
filename hash - f1b65d2f64f7733dc4519fc4ffc0de7192e00211
file extension - .png

If you'd like to inspect how this works yourself...
http://trac.edgewall.org/browser/trunk/trac/attachment.py#L173
Take a look at the _get_path and _get_hashed_filename methods.

Enjoy!

Ben

On Sun, Oct 21, 2012 at 9:18 PM, Benjamin Lau <[email protected]> wrote:
> Hello,
>
> Last time I looked attachments used the actual file names and wiki
> "path" for their storage on disk... but that seems to no longer be the
> case. They now seem to use a hash of something for their names. I was
> wondering what this naming scheme was?
>
> Thanks,
>
> Ben

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to