fixed label and file name conflicts for export

This commit is contained in:
Matthias Nadler 2019-07-16 18:44:39 +02:00
parent 459b7a4c5c
commit a89f0df161

View File

@ -1066,7 +1066,8 @@ class Poll:
async def export(self): async def export(self):
"""Create export file and return path""" """Create export file and return path"""
if not self.open: if not self.open:
fn = 'export/' + str(self.server.id) + '_' + str(self.short) + '.txt' clean_label = str(self.short).replace("/", "").replace(".", "")
fn = 'export/' + str(self.server.id) + '_' + clean_label + '.txt'
with codecs.open(fn, 'w', 'utf-8') as outfile: with codecs.open(fn, 'w', 'utf-8') as outfile:
outfile.write(await self.to_export()) outfile.write(await self.to_export())
return fn return fn