# HG changeset patch # User Björn Ricks # Date 1413452751 -7200 # Node ID 00e12392f8d48c54f83ab50e81f5dfbbad837479 # Parent e6f2f1481de29a4a0c67cc2cca282259dacca1dc Fix saving uploaded form file to a temporary file The file must be saved to a temporary file for conversion via pyuno. pyuno can only accept filenames. Also the file position must be reset to the start. If the position is not reset we will get a IllegalArgumentException: Unsupported URL from pyuno when converting a file without template rendering. diff -r e6f2f1481de2 -r 00e12392f8d4 odfcast/convert.py --- a/odfcast/convert.py Thu Oct 16 11:35:47 2014 +0200 +++ b/odfcast/convert.py Thu Oct 16 11:45:51 2014 +0200 @@ -78,9 +78,10 @@ return render_template("convert.html") def save_form_file(self, infile): - outfile = tempfile.TemporaryFile() + outfile = tempfile.NamedTemporaryFile() infile.save(outfile) infile.close() + outfile.seek(0) return outfile def convert(self, infile, fformat):