Commit 10d9fed4 authored by Łukasz Nowak's avatar Łukasz Nowak

Follow shadir and shacache spec change.

parent b2134dc5
......@@ -557,9 +557,8 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
class NCHandler(Handler):
def do_POST(self):
path = os.path.abspath(os.path.join(self.tree, *self.path.split('/')))
d = os.path.dirname(path)
if not os.path.exists(d):
os.makedirs(d)
if not os.path.exists(path):
os.makedirs(path)
data = self.rfile.read(int(self.headers.getheader('content-length')))
sha512 = hashlib.sha512(data).hexdigest()
try:
......@@ -568,7 +567,7 @@ class NCHandler(Handler):
pass
else:
data = json.dumps([d])
open(path, 'wb').write(data)
open(os.path.join(path, sha512), 'wb').write(data)
self.send_response(201)
self.send_header('Content-Length', str(len(sha512)))
self.send_header('Content-Type', 'text/html')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment