Skip to content

Commit

Permalink
Merge pull request #711 from plone/yurj-fix-relative-path
Browse files Browse the repository at this point in the history
fix use of relative urls in replace_link_variables_by_paths and in the Link view
  • Loading branch information
yurj authored Nov 18, 2024
2 parents 450888e + 0c6f362 commit db05318
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions news/711.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[yurj] fix use of relative urls in replace_link_variables_by_paths and in the Link view
4 changes: 1 addition & 3 deletions plone/app/contenttypes/browser/link_redirect_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ def display_link(self):
obj = uuidToObject(uid)
if obj:
title = obj.Title()
meta = "/".join(obj.getPhysicalPath()[2:])
if not meta.startswith("/"):
meta = "/" + meta
meta = obj.absolute_url_path()
return {
"title": title,
"meta": meta,
Expand Down
6 changes: 5 additions & 1 deletion plone/app/contenttypes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def replace_link_variables_by_paths(context, url):


def _replace_variable_by_path(url, variable, obj):
path = "/".join(obj.getPhysicalPath())
path = obj.absolute_url_path()
# if path is '/' (didn't happen with getPhysicalPath), avoid
# ${navigation_root_url}/sitemap -> //sitemap
if path == "/":
path = ""
return url.replace(variable, path)


Expand Down

0 comments on commit db05318

Please sign in to comment.