torchbox / wagtail-grapple

A Wagtail app that makes building GraphQL endpoints a breeze!
https://wagtail-grapple.readthedocs.io/en/latest/
Other
153 stars 57 forks source link

Ensure `new_url` is absolute in Redirects #391

Closed JakubMastalerz closed 4 months ago

JakubMastalerz commented 4 months ago

resolves #384

This PR changes new_url handling in RedirectType to ensure that the returned value is always an absolute URL.

In resolve_new_url, instead of relying entirely on the link property of the Redirect model, a check was added to ensure the URL being passed is absolute when the redirect does not point to a specific Page object. Relative URLs will be turned into absolute URLs.