﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
8222	Storage should reset file's cursor after saving	Julien Phalip	nobody	"I had some trouble finding the cause of that problem. Basically, I was trying to save an uploaded image and then manipulate that image with PIL. But the following didn't work:

{{{

from PIL import Image

storage.save('/images/image.gif', uploaded_file) # Save the original
uploaded_image = Image.open(uploaded_file)
...

}}}

After debugging PIL I realised that it assumes the given file starts at position 0. Therefore, the following works:

{{{

from PIL import Image

storage.save('/images/image.gif', uploaded_file) # Save the original
uploaded_file.seek(0) # >> REWIND FILE <<
uploaded_image = Image.open(uploaded_file)
...

}}}

I think it would be good practice to automatically rewind the file after it's been saved, so that other tools can process the file without having to rewind it manually. That would feel more logical from an outside perspective.

Patch attached."	Uncategorized	closed	File uploads/storage	dev	Normal	wontfix			Accepted	1	0	0	0	0	0
