clean internfiles

This commit is contained in:
www
2020-12-28 08:13:40 +00:00
parent 9f88d3c08f
commit 31b3384bd5
2 changed files with 5 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ from slugify import slugify
import re
from flask import redirect, url_for, send_from_directory
from .pth import pth
import bs4
bp = Blueprint("internfiles", __name__, url_prefix="/internfiles")
@@ -61,9 +61,10 @@ def web(path=""):
if f and f.endswith(".txt"):
text = os.path.abspath(f)
with open(os.path.abspath(f), "r") as fh:
text = fh.read()
with open(os.path.abspath(f), "r", encoding='utf-8') as fh:
text = (fh.read())
text = re.sub("\\n\s*\\n", "<br>", text)
#text=bs4.BeautifulSoup(text).text
elif f:
return send_from_directory(str(f - 1), str(f[-1]))
return render_template("internfiles.html", file=f, dir=d, text=text, path=pth(d.p))