diff --git a/interface.py b/interface.py index 1909fad..e4b01e2 100644 --- a/interface.py +++ b/interface.py @@ -122,6 +122,7 @@ def index(): user=var.user) +@web.route('/upload', methods=["POST"]) def upload(): file = request.files['file'] if not file: @@ -137,14 +138,15 @@ def upload(): elif '../' in targetdir: return redirect("./", code=406) - # print('Uploading file:') - # print('filename:', filename) - # print('targetdir:', targetdir) - # print('mimetype:', file.mimetype) + print('Uploading file:') + print('filename:', filename) + print('targetdir:', targetdir) + print('mimetype:', file.mimetype) if "audio" in file.mimetype: storagepath = os.path.abspath(os.path.join(var.music_folder, targetdir)) - if not storagepath.startswith(var.music_folder): + print('storagepath:',storagepath) + if not storagepath.startswith(os.path.abspath(var.music_folder)): return redirect("./", code=406) try: @@ -154,6 +156,7 @@ def upload(): return redirect("./", code=500) filepath = os.path.join(storagepath, filename) + print('filepath:',filepath) if os.path.exists(filepath): return redirect("./", code=406) diff --git a/templates/index.html b/templates/index.html index 70f3d4c..5104ff6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,6 +2,7 @@
Type | -Title | -Url/Path | -Action | -
---|---|---|---|
{{ m['type'] }} | -- {% if 'title' in m %} - ({{ m['title'] }}) - {% else %} - No title - {% endif %} - | -- {% if 'url' in m %} - ({{ m['url'] }}) - {% elif 'path' in m %} - ({{ m['path'] }}) - {% endif %} - | -- - | -
# | +Type | +Title | +Url/Path | +Action | +
---|---|---|---|---|
{{ loop.index }} | +{{ m['type'] }} | ++ {% if 'title' in m %} + ({{ m['title'] }}) + {% else %} + No title + {% endif %} + | ++ {% if 'url' in m %} + {{ m['url'] }} + {% elif 'path' in m %} + {{ m['path'] }} + {% endif %} + | ++ + | +