summaryrefslogtreecommitdiffstats
path: root/core/views/expo.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/expo.py')
-rw-r--r--core/views/expo.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/views/expo.py b/core/views/expo.py
index c6ef01b..b6644f3 100644
--- a/core/views/expo.py
+++ b/core/views/expo.py
@@ -125,9 +125,12 @@ def expowebpage(request, expowebpath, path):
print(f' - 404 error in expowebpage() {path}')
return render(request, 'pagenotfound.html', {'path': path}, status="404")
- with open(os.path.normpath(expowebpath / path), "r") as o:
- html = o.read()
-
+ try:
+ with open(os.path.normpath(expowebpath / path), "r") as o:
+ html = o.read()
+ except:
+ return HttpResponse(default_head + html + '<h3>UTF-8 Parsing Failue:<br>Page could not be parsed using UTF-8:<br>failure detected in expowebpage in views.expo.py</h3> Please edit this <var>:expoweb:</var> page to replace dubious umlauts with HTML entitiies in the expected code. </body' )
+
m = re.search(r'(.*)<\s*head([^>]*)>(.*)<\s*/head\s*>(.*)<\s*body([^>]*)>(.*)<\s*/body\s*>(.*)', html, re.DOTALL + re.IGNORECASE)
if m:
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()