From a31ccd4ab9c66faea772694b8f1f6ced79556568 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 7 Feb 2017 23:25:57 -0800 Subject: [PATCH] Fix use of docker volume --- docker/default | 1 + imghost/api.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/default b/docker/default index 13848e6..e0198ee 100644 --- a/docker/default +++ b/docker/default @@ -11,6 +11,7 @@ server { location /api { proxy_pass http://127.0.0.1:3000; + client_max_body_size 16M; } #error_page 404 /404.html; diff --git a/imghost/api.py b/imghost/api.py index 9050daf..a6f75e8 100644 --- a/imghost/api.py +++ b/imghost/api.py @@ -4,7 +4,7 @@ import os import cgi import tempfile import subprocess - +from shutil import copyfile class Mountable(object): """ @@ -72,7 +72,7 @@ class ImgHostApiV1(Mountable): sha = subprocess.check_output(["sha512sum", theFile.file.name]) sha = sha.decode("UTF-8").split(" ")[0] imgpath = os.path.join("i", "{}.{}".format(sha[0:8], ext)) - os.link(theFile.file.name, os.path.join("ui", imgpath)) + copyfile(theFile.file.name, os.path.join("ui", imgpath)) cherrypy.response.headers['Location'] = "/" + imgpath cherrypy.response.status = 302