#4420 Fix linking to issues or PRs when pre-viewing a comment
Merged 2 years ago by pingou. Opened 2 years ago by pingou.

file modified
+3 -3
@@ -528,9 +528,9 @@ 

      root = flask.request.url_root

      url = flask.request.url


-     user = flask.request.args.get("user")

-     namespace = flask.request.args.get("namespace")

-     repo = flask.request.args.get("repo")

+     user = flask.request.args.get("user") or None

+     namespace = flask.request.args.get("namespace") or None

+     repo = flask.request.args.get("repo") or None


      if not user and not repo:

          if "fork/" in url:

Basically the old mechanism was retrieving an user '' which was not
considered to be None, so when searching for the matched issue/PR,
none were found and thus the text version was returned.
With this change, we ask that username, project name or project
namespace are all either something or None. The code is then
able to find the issue/PR referenced in a comment when previewing

Fixes https://pagure.io/pagure/issue/4319

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

Pull-Request has been merged by pingou

2 years ago