|
@@ -303,14 +303,16 @@ class AddLink(Endpoint):
|
|
|
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)
|
|
|
+
|
|
|
+ args = flask.request.args.copy()
|
|
|
|
|
|
# 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())
|
|
|
+ url = args.get("url", None)
|
|
|
+ text = args.get("text", "")
|
|
|
+ if url is None and text.startswith("http"):
|
|
|
+ args["url"] = text
|
|
|
+ del args['text']
|
|
|
+
|
|
|
+ args = "&".join(f"{key}={value}" for key, value in args.items())
|
|
|
|
|
|
raise e.LCRedirect(f"/u/{self.user.name}/l?{args}")
|