From dc88fcd1751f2171caaf60232bdda6d4a2654397 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 22 Dec 2013 12:13:37 +0000 Subject: [PATCH] use _ for spaces in document urls, fixes #1955 --- pandora/document/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora/document/models.py b/pandora/document/models.py index c315398f2..36bb4b51e 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -77,7 +77,7 @@ class Document(models.Model): @classmethod def parse_id(cls, id): - public_id = id.split(':') + public_id = id.replace('_', ' ').replace('\t', '_').split(':') username = public_id[0] name = ":".join(public_id[1:]) extension = name.split('.') @@ -89,7 +89,9 @@ class Document(models.Model): return ('/documents/%s' % quote(self.get_id())).replace('%3A', ':') def get_id(self): - return u'%s:%s.%s' % (self.user.username, self.name, self.extension) + id = u'%s:%s.%s' % (self.user.username, self.name, self.extension) + id = id.replace('_', '%09').replace(' ', '_') + return id def editable(self, user): if not user or user.is_anonymous():