Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

Hotfix spaces in URL in GET requests

vkosnar5a9a69029950
diff --git a/src/rembg/cmd/server.py b/src/rembg/cmd/server.py
index 9e3a926..dc797d5 100644
--- a/src/rembg/cmd/server.py
+++ b/src/rembg/cmd/server.py
@@ -27,8 +27,12 @@ def index():
url = request.args.get("url", type=str)
if url is None:
return {"error": "missing query param 'url'"}, 400
+
+ url = unquote_plus(url)
+ if " " in url:
+ url = quote(url, safe="/:")
- file_content = urlopen(unquote_plus(url)).read()
+ file_content = urlopen(url).read()
if file_content == "":
return {"error": "File content is empty"}, 400