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