From ffd729918727e1253fc2079be19e9d55a3b13aad Mon Sep 17 00:00:00 2001 From: Grygoriy Fuchedzhy Date: Sun, 2 Oct 2011 19:28:47 +0300 Subject: [PATCH 1/2] added support for encoded urls to hyde server --- hyde/server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hyde/server.py b/hyde/server.py index 4157424..6fe0592 100644 --- a/hyde/server.py +++ b/hyde/server.py @@ -55,9 +55,8 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): Finds the absolute path of the requested file by referring to the `site` variable in the server. """ - path = SimpleHTTPRequestHandler.translate_path(self, path) site = self.server.site - result = urlparse.urlparse(self.path) + result = urlparse.urlparse(urllib.unquote(self.path).decode('utf-8')) logger.debug("Trying to load file based on request: [%s]" % result.path) path = result.path.lstrip('/') res = None From 1d97e00924c8a783f0e62efa1e1615e035b593c9 Mon Sep 17 00:00:00 2001 From: Grygoriy Fuchedzhy Date: Fri, 14 Oct 2011 01:22:00 +0300 Subject: [PATCH 2/2] encode return value of media_url and content_url functions --- hyde/site.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hyde/site.py b/hyde/site.py index 68f466b..ebb9f6d 100644 --- a/hyde/site.py +++ b/hyde/site.py @@ -6,6 +6,7 @@ import os import fnmatch import urlparse from functools import wraps +from urllib import quote from hyde.exceptions import HydeException from hyde.fs import FS, File, Folder @@ -403,14 +404,14 @@ class Site(object): Returns the content url by appending the base url from the config with the given path. """ - return Folder(self.config.base_url).child(path).replace(os.sep, '/') + return quote(Folder(self.config.base_url).child(path).replace(os.sep, '/').encode("utf-8")) def media_url(self, path): """ Returns the media url by appending the media base url from the config with the given path. """ - return Folder(self.config.media_url).child(path).replace(os.sep, '/') + return quote(Folder(self.config.media_url).child(path).replace(os.sep, '/').encode("utf-8")) def full_url(self, path): """