From b11d294f596a9842493d65d278f47523c3c52509 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Thu, 20 Oct 2022 10:23:49 +0200 Subject: [PATCH] fix JSON call url --- CHANGES.rst | 3 ++- src/plone/formwidget/masterselect/widget.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0d674ee..32a76b0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 2.0.2 (unreleased) ------------------ -- Nothing changed yet. +- Fix JSON call URL in non-rooted virtual host environments. Fixes #37 + [erral] 2.0.1 (2021-09-16) diff --git a/src/plone/formwidget/masterselect/widget.py b/src/plone/formwidget/masterselect/widget.py index 200e8a5..94206e9 100644 --- a/src/plone/formwidget/masterselect/widget.py +++ b/src/plone/formwidget/masterselect/widget.py @@ -70,7 +70,12 @@ def getSlaves(self): yield slave.copy() def renderJS(self): - url = '/'.join(self.request.physicalPathFromURL(self.request.getURL())) + url = "/".join( + [""] + + self.request.physicalPathToVirtualPath( + self.request.physicalPathFromURL(self.request.getURL()) + ), + ) widgetURL = url + '/++widget++%s/@@masterselect-jsonvalue' % self.__name__ for slave in self.getSlaves():