Compare commits

..

No commits in common. "5f29a595f0c1302e6e7db3916b5a65f5586a6fde" and "9c814269748bb8c87a481ee4bd092b7571524d1e" have entirely different histories.

View File

@ -79,10 +79,9 @@ async def to_hosts(filename: str, data: str, newversion: str):
with open(newfilename, "w") as output:
if name == "hosts":
pattern = r"(?<=^\|\|)\S+\.\S{2,}(?=\^)"
newoutput = ""
for e in re.findall(pattern, newdata, re.MULTILINE):
if "*" not in e:
newoutput += "0.0.0.0 " + e + "\n"
newoutput = "\n".join(
"0.0.0.0 " + e for e in re.findall(pattern, newdata, re.MULTILINE)
)
else:
newoutput = "\n".join("0.0.0.0 " + e for e in data)
output.write(newhead)