Handle the reverter file registration before opening file handle

This commit is contained in:
Joona Hoikkala 2018-01-15 00:54:35 +02:00
parent e191bdb374
commit 75d90856c9
No known key found for this signature in database
GPG key ID: 1708DAE66E87A524

View file

@ -101,9 +101,9 @@ Alias /.well-known/acme-challenge {0}
name = os.path.join(self.challenge_dir, achall.chall.encode("token"))
self.configurator.reverter.register_file_creation(True, name)
with open(name, 'wb') as f:
f.write(validation.encode())
self.configurator.reverter.register_file_creation(True, name)
os.chmod(name, 0o644)
return response