Skip to content

Commit

Permalink
Simplify url constrction in link_redirect_view
Browse files Browse the repository at this point in the history
  • Loading branch information
1letter committed Oct 19, 2023
1 parent 4fae87e commit 9a2e653
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions plone/app/contenttypes/browser/link_redirect_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,7 @@ def absolute_target_url(self):
if "resolveuid" in url:
uid = url.split("/")[-1]
obj = uuidToObject(uid)

portal_state = getMultiAdapter(
(self.context, self.request), name="plone_portal_state"
)

portal = portal_state.portal()
portal_url = portal_state.portal_url()

path_pieces = tuple(
set(portal.getPhysicalPath()) ^ set(obj.getPhysicalPath())
)

if obj:
url = "/".join(path_pieces)
if not url.startswith("/"):
url = f"{portal_url}/{url}"
url = obj.absolute_url()
if not url.startswith(("http://", "https://")):
url = self.request["SERVER_URL"] + url

Expand Down

0 comments on commit 9a2e653

Please sign in to comment.