can't access paths with slashes

I have a file test/test in my repository. It appears to be inaccessible through hatta. Directories are very useful for namespaces (not categories as elsewhere mentioned).

Attempted fix (does not work) will turn two slashes into one, and leave single slashes as escape sequences. Just an experiment, really.

# HG changeset patch
# User Travis Wellman <twellman@gmail.com>
# Date 1232706092 28800
# Node ID 200f60a00a565b1b9cfc97df04b2a70de9c238b3
# Parent  d069c4d142fbb43751170429da6871b35e7df172
maybe this will work for accessing paths

diff --git a/hatta.py b/hatta.py
--- a/hatta.py
+++ b/hatta.py
@@ -932,6 +932,7 @@
                 href = addr
         else:
             addr = addr.replace('/', '%2F')
+            addr = addr.replace('%2F%2F', '/')
             if '#' in addr:
                 addr, chunk = addr.split('#', 1)
                 chunk = '#%s' % chunk
@@ -1234,6 +1235,7 @@
                 if external_link(addr):
                     return u''
                 addr = addr.replace('/', '%2F')
+                addr = addr.replace('%2F%2F', '/')
                 if '#' in addr:
                     addr, chunk = addr.split('#', 1)
                 if addr == u'':

I'll probably look at this more later. This project is a good reason for me to familiarize myself with python anyhow.


Hatta %-encodes any characters that may have special meaning in the underlying filesystem. The slashes and backslashes are especially important here, because if you didn't encode them, it would be possible to access arbitrary files in the filesystem – which we definitely don't want.

You can use slashes in page titles normally, provided you create them from Hatta (or properly %-encode). The slashes in page titles do not have any special meaning, however. They are used for pages such as "input/output" or "3/4 litre" (note that slash handling in wiki links was broken in Hatta 1.2.1, it's fixed in the development version that will be released as 1.2.2).

Hatta is supposed to be a simple wiki, ideally using one instance for one topic. You can run several instances of Hatta (possibly even on a single instance of the script, using some simple WSGI middleware for dispatching) in the same repository, in different directories.

I'm sorry, but this moment had to come sooner or later: it's a feature not bug. – Radomir Dopieralski


There were indeed some bugs in the handling of page titles with slashes in them. They have been squashed (at least the ones I know about). – Radomir Dopieralski


Issues, Fixed Bugs