[web/views] unlink svg temp file after we're done
Otherwise we fill up the tempdir. Closes #9133268.
--- a/web/views/schema.py Wed Dec 09 16:36:17 2015 +0100
+++ b/web/views/schema.py Mon Dec 14 12:11:44 2015 +0100
@@ -657,10 +657,13 @@
}))
# svg image file
fd, tmpfile = tempfile.mkstemp('.svg')
- os.close(fd)
- generator.generate(visitor, prophdlr, tmpfile)
- with codecs.open(tmpfile, 'rb', encoding='utf-8') as svgfile:
- self.w(svgfile.read())
+ try:
+ os.close(fd)
+ generator.generate(visitor, prophdlr, tmpfile)
+ with codecs.open(tmpfile, 'rb', encoding='utf-8') as svgfile:
+ self.w(svgfile.read())
+ finally:
+ os.unlink(tmpfile)
# breadcrumbs ##################################################################