﻿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
15247	FileField has max_length=100 but filestorage may return something way longer	Harro	nobody	"So to keep al the uploaded files a bit sorted they all get added to specific folders. MEDIA_ROOT + 'user/10/profile/files/'

Then the user comes along and uploads a file with a very long name then the FileStorage stores the file just fine, the path get's returned and through the ORM passed to the database backend which might throw an error about the filefield exceeting 100 characters.

Mysql for instance just trims the value without complaining, thus storing an incomplete path.
Postgres will throw an exception which the user gets as a 500 error and we get an e-mail that we have to fix it.


Solutions:
- Don't store the path in the database, keep that in the upload_to for the model, downside is that if it changes all the already uploaded files will not be found.
- FileStorage should make sure the path doesn't exceed max_length, downside is that if the path part is 99 characters long the filename gets 1 character. (Or 120 and -20 :P)
- FileField should validate the length of the path returned and give the user the error that they should shorted their filename to max X characters (X being dependand on the path prefix) 


Which is best, I don't know, maybe a combination of those things.
"	Bug	closed	File uploads/storage	dev	Normal	duplicate		Harro	Accepted	0	0	0	0	0	0
