diff --git a/CHANGES.rst b/CHANGES.rst index 0d674ee..d5ca107 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 2.0.2 (unreleased) ------------------ -- Nothing changed yet. +- Fix JSON call URL in virtual hosted 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():