diff --git a/plugins/Zeroname/UiRequestPlugin.py b/plugins/Zeroname/UiRequestPlugin.py
index b0230524a..eacb0aa00 100644
--- a/plugins/Zeroname/UiRequestPlugin.py
+++ b/plugins/Zeroname/UiRequestPlugin.py
@@ -11,16 +11,6 @@ def __init__(self, *args, **kwargs):
self.site_manager = SiteManager.site_manager
super(UiRequestPlugin, self).__init__(*args, **kwargs)
- # Media request
- def actionSiteMedia(self, path, **kwargs):
- match = re.match(r"/media/(?P
[A-Za-z0-9-]+\.[A-Za-z0-9\.-]+)(?P/.*|$)", path)
- if match: # Its a valid domain, resolve first
- domain = match.group("address")
- address = self.site_manager.resolveDomain(domain)
- if address:
- path = "/media/" + address + match.group("inner_path")
- return super(UiRequestPlugin, self).actionSiteMedia(path, **kwargs) # Get the wrapper frame output
-
@PluginManager.registerTo("ConfigPlugin")
class ConfigPlugin(object):
def createArguments(self):
diff --git a/src/Ui/UiRequest.py b/src/Ui/UiRequest.py
index 2aa87af26..fa3719e52 100644
--- a/src/Ui/UiRequest.py
+++ b/src/Ui/UiRequest.py
@@ -310,6 +310,7 @@ def sendHeader(self, status=200, content_type="text/html", noscript=False, allow
# Renders a template
def render(self, template_path, *args, **kwargs):
template = open(template_path, encoding="utf8").read()
+
def renderReplacer(m):
return "%s" % kwargs.get(m.group(1), "")
@@ -559,6 +560,8 @@ def parsePath(self, path):
match = re.match(r"/media/(?P[A-Za-z0-9]+[A-Za-z0-9\._-]+)(?P/.*|$)", path)
if match:
path_parts = match.groupdict()
+ if self.isDomain(path_parts["address"]):
+ path_parts["address"] = self.resolveDomain(path_parts["address"])
path_parts["request_address"] = path_parts["address"] # Original request address (for Merger sites)
path_parts["inner_path"] = path_parts["inner_path"].lstrip("/")
if not path_parts["inner_path"]:
@@ -578,6 +581,7 @@ def actionSiteMedia(self, path, header_length=True, header_noscript=False):
return self.error404(path)
address = path_parts["address"]
+
file_path = "%s/%s/%s" % (config.data_dir, address, path_parts["inner_path"])
if (config.debug or config.merge_media) and file_path.split("/")[-1].startswith("all."):