mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'development' of github.com:lstein/stable-diffusion into development
This commit is contained in:
commit
9208bfd151
@ -103,10 +103,14 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(bytes('{}', 'utf8'))
|
self.wfile.write(bytes('{}', 'utf8'))
|
||||||
else:
|
else:
|
||||||
path = "." + self.path
|
path_dir = os.path.dirname(self.path)
|
||||||
cwd = os.path.realpath(os.getcwd())
|
out_dir = os.path.realpath(self.outdir.rstrip('/'))
|
||||||
is_in_cwd = os.path.commonprefix((os.path.realpath(path), cwd)) == cwd
|
if self.path.startswith('/static/dream_web/'):
|
||||||
if not (is_in_cwd and os.path.exists(path)):
|
path = '.' + self.path
|
||||||
|
elif out_dir.endswith(path_dir):
|
||||||
|
file = os.path.basename(self.path)
|
||||||
|
path = os.path.join(self.outdir,file)
|
||||||
|
else:
|
||||||
self.send_response(404)
|
self.send_response(404)
|
||||||
return
|
return
|
||||||
mime_type = mimetypes.guess_type(path)[0]
|
mime_type = mimetypes.guess_type(path)[0]
|
||||||
@ -114,7 +118,7 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header("Content-type", mime_type)
|
self.send_header("Content-type", mime_type)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
with open("." + self.path, "rb") as content:
|
with open(path, "rb") as content:
|
||||||
self.wfile.write(content.read())
|
self.wfile.write(content.read())
|
||||||
else:
|
else:
|
||||||
self.send_response(404)
|
self.send_response(404)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user