forked from expo/troggle
Prevent modification of auto generated files
This commit is contained in:
parent
1ef274ec1d
commit
a29fd964bd
@ -107,6 +107,9 @@ def editflatpage(request, path):
|
||||
filepath = os.path.normpath(settings.EXPOWEB + path)
|
||||
o = open(filepath, "r")
|
||||
html = o.read()
|
||||
autogeneratedmatch = re.search(r"\<\!--\s*(.*?(Do not edit|auto-generated).*?)\s*--\>", html, re.DOTALL + re.IGNORECASE)
|
||||
if autogeneratedmatch:
|
||||
return HttpResponse(autogeneratedmatch.group(1))
|
||||
m = re.search(r"(.*)<head([^>]*)>(.*)</head>(.*)<body([^>]*)>(.*)</body>(.*)", html, re.DOTALL + re.IGNORECASE)
|
||||
if m:
|
||||
filefound = True
|
||||
|
Loading…
Reference in New Issue
Block a user