diff options
Diffstat (limited to 'module/web/pyload')
| -rw-r--r-- | module/web/pyload/templatetags/quotepath.py | 29 | ||||
| -rw-r--r-- | module/web/pyload/views.py | 7 | 
2 files changed, 32 insertions, 4 deletions
| diff --git a/module/web/pyload/templatetags/quotepath.py b/module/web/pyload/templatetags/quotepath.py new file mode 100644 index 000000000..a38932d59 --- /dev/null +++ b/module/web/pyload/templatetags/quotepath.py @@ -0,0 +1,29 @@ +from django.template.defaultfilters import stringfilter +from django import template + +register = template.Library() + +quotechar = "::/" + +@stringfilter +def quotepath(path): +    try: +        return path.replace("../", quotechar) +    except AttributeError: +        return path +    except: +        return "" + + +register.filter(quotepath) + +@stringfilter +def unquotepath(path): +    try: +        return path.replace(quotechar, "../") +    except AttributeError: +        return path +    except: +        return "" + +register.filter(unquotepath)
\ No newline at end of file diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index c1cd31f5f..0fcabaede 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -14,6 +14,7 @@ from datetime import datetime  from time import localtime, strftime  from copy import deepcopy  from operator import itemgetter +from pyload.templatetags import quotepath  from django.conf import settings  from django.contrib.auth.decorators import login_required @@ -387,7 +388,7 @@ def root(request, type):  @permission('pyload.can_change_status')  @check_server  def path(request, path, type): -     +    path = quotepath.unquotepath(path)      if os.path.isfile(path):          oldfile = path          path = os.path.dirname(path) @@ -443,6 +444,4 @@ def path(request, path, type):      files = sorted(files, key=itemgetter('type', 'sort')) -    return render_to_response(join(settings.TEMPLATE, 'pathchooser.html'), {'cwd': cwd, 'files': files, 'parentdir': parentdir, 'type': type, 'oldfile': oldfile}, RequestContext(request)) - - +    return render_to_response(join(settings.TEMPLATE, 'pathchooser.html'), {'cwd': cwd, 'files': files, 'parentdir': parentdir, 'type': type, 'oldfile': oldfile}, RequestContext(request))
\ No newline at end of file | 
