From 31fa92a83f6dabfe4064084304326f305d6f0702 Mon Sep 17 00:00:00 2001 From: David Ford <2772469+david-ford@users.noreply.github.com> Date: Mon, 29 Aug 2022 12:46:24 -0500 Subject: [PATCH] Fix case sensitive check to be case insensitive Case sensitivity between os.getcwd and os.realpath can fail due to different drive letter casing. C:\ vs c:\. This change addresses that by normalizing the strings before comparing. --- .gitattributes | 4 ++++ ldm/dream/server.py | 4 ++-- static/dream_web/index.html | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..61934b8002 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Auto normalizes line endings on commit so devs don't need to change local settings. +# Only effects text files and ignores other file types. +# For more info see: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/ +* text=auto diff --git a/ldm/dream/server.py b/ldm/dream/server.py index efe3139f74..bf73b5dca4 100644 --- a/ldm/dream/server.py +++ b/ldm/dream/server.py @@ -17,8 +17,8 @@ class DreamServer(BaseHTTPRequestHandler): self.wfile.write(content.read()) else: path = "." + self.path - cwd = os.getcwd() - is_in_cwd = os.path.commonprefix((os.path.realpath(path), cwd)) == cwd + cwd = os.getcwd().lower() + is_in_cwd = os.path.commonprefix((os.path.realpath(path).lower(), cwd)) == cwd if not (is_in_cwd and os.path.exists(path)): self.send_response(404) return diff --git a/static/dream_web/index.html b/static/dream_web/index.html index 34ee69bad2..4b49d49bc7 100644 --- a/static/dream_web/index.html +++ b/static/dream_web/index.html @@ -1,6 +1,7 @@ - + Stable Diffusion Dream Server + @@ -13,7 +14,7 @@
@@ -70,7 +71,7 @@