Explorar el Código

Handle weird android case in /add-link

Trevor Elliott hace 3 años
padre
commit
7d2a0d78c2
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      lc/app.py

+ 10 - 1
lc/app.py

@@ -302,6 +302,15 @@ class AddLink(Endpoint):
     def html(self):
         if not self.user:
             raise e.LCRedirect("/login")
+
+        url = flask.request.args.get("text", None)
+        name = flask.request.args.get("name", None)
+        text = flask.request.args.get("text", None)
+
+        # Android sets the text field to the url only
+        if url is None and name is None and text is not None:
+            args = f"url={text}"
         else:
             args = "&".join(f"{key}={value}" for key, value in flask.request.args.items())
-            raise e.LCRedirect(f"/u/{self.user.name}/l?{args}")
+
+        raise e.LCRedirect(f"/u/{self.user.name}/l?{args}")