diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-19 21:58:08 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-19 21:58:08 +0100 |
commit | 63f8af1fc3049527a4a4b53a1bbfde90cb4b2eb3 (patch) | |
tree | 8227674ebd87c28df53bad55de401a9264a283b4 /module/web/json_app.py | |
parent | fixed cli unicode error (diff) | |
download | pyload-63f8af1fc3049527a4a4b53a1bbfde90cb4b2eb3.tar.xz |
encoding fixes
Diffstat (limited to 'module/web/json_app.py')
-rw-r--r-- | module/web/json_app.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/module/web/json_app.py b/module/web/json_app.py index f10c09498..8eb2dbbfe 100644 --- a/module/web/json_app.py +++ b/module/web/json_app.py @@ -210,7 +210,7 @@ def link_order(ids): @route("/json/add_package", method="POST") @login_required('can_add') def add_package(): - name = request.forms['add_name'] + name = request.forms.get("add_name", "New Package") queue = int(request.forms['add_dest']) links = request.forms['add_links'].decode("utf8", "ignore") links = links.split("\n") @@ -219,7 +219,7 @@ def add_package(): try: f = request.files['add_file'] - if name is None or name == "": + if name == "New Package": name = f.name fpath = join(PYLOAD.get_conf_val("general", "download_folder"), "tmp_" + f.filename) @@ -230,9 +230,6 @@ def add_package(): except: pass - if name is None or name == "": - return HTTPError() - name = name.decode("utf8", "ignore") links = map(lambda x: x.strip(), links) @@ -283,10 +280,10 @@ def move_package(dest, id): def edit_package(): try: id = int(request.forms.get("pack_id")) - data = {"name": request.forms.get("pack_name"), - "folder": request.forms.get("pack_folder"), + data = {"name": request.forms.get("pack_name").decode("utf8", "ignore"), + "folder": request.forms.get("pack_folder").decode("utf8", "ignore"), "priority": request.forms.get("pack_prio"), - "password": request.forms.get("pack_pws")} + "password": request.forms.get("pack_pws").decode("utf8", "ignore")} PYLOAD.set_package_data(id, data) return "success" |