scragg0x / realms-wiki

Git based wiki inspired by Gollum
http://realms.io
GNU General Public License v2.0
831 stars 90 forks source link

Preliminary subdirectory support. refs #50 #86

Closed gazpachoking closed 8 years ago

gazpachoking commented 8 years ago

I had an initial go at allowing subdirectory support. Could it be this easy? Is there other stuff that needs to be updated?

TODO?:

gazpachoking commented 8 years ago

Been testing this out a bit in preparation for rolling our old trac wiki over to this, and it seems to be handling everything as expected.

scragg0x commented 8 years ago

Thanks, I will do some tests as well before I push to pypi.

gazpachoking commented 8 years ago

@scragg0x Been thinking a bit more... One thing I wasn't sure of, should the 128 length limit be per component of path, and not for the whole thing? I also think we need to split path before certain other sanitizing as well, e.g. things like removing the leading underscore won't currently work for subdirs.

scragg0x commented 8 years ago

@gazpachoking You are correct. Each folder/file should be no longer than 63 chars. As for total path size no longer than 436. I only care about the very beginning underscore, so subsequent ones are ok. And lets make sure the path doesn't end in a /

63 = floor( 256 (file name byte limit) / 4 (unicode max bytes per char) )

436 = (2000(link) - 256 (domain max size)) / 4 (unicode max bytes)

Not quite sure about unicode in the URL but I think dividing by 4 is on the safe size. If you want to do this go for it. I won't have time until tomorrow evening.