[WIP] NAS: Moved action='contents' in dlc

This commit is contained in:
Sepalani 2016-02-21 19:47:07 +01:00
parent 867cd538ae
commit 428dbcca97
2 changed files with 11 additions and 4 deletions

View File

@ -258,11 +258,8 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
ret = dlc.download_list(dlc_path, post)
if action == "contents":
# Get only the base filename just in case there is a path
# involved somewhere in the filename string.
ret = dlc.download_contents(dlc_path, post)
dlc_contenttype = True
contents = os.path.basename(post["contents"])
ret = dlc.safeloadfi(dlcpath, contents)
self.send_response(200)

View File

@ -206,3 +206,13 @@ def download_list(dlc_path, post):
attr1, attr2, attr3,
num, offset
)
def download_contents(dlc_path, post):
"""Handle download contents request.
Get only the base filename just in case there is a path involved
somewhere in the filename string.
"""
contents = os.path.basename(post["contents"])
return safeloadfi(dlc_path, contents)