﻿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
2923	[patch] FileField does not allow modifications on Windows	radek	Adrian Holovaty	"When you have FileField (or ImageField) and use Django on Windows, second time uploaded filename is always considered invalid.
Ie. you can create one instance, but you can't go back and edit this one and save. You always get:

    Enter a valid filename.

The issue is in 

\django\trunk\django\db\models\fields\__init__.py  on line 579

Because
os.path.abspath(os.path.join(settings.MEDIA_ROOT, field_data)):

will give: 
'D:\\www\\myproject\\media\\subfolder\\1-icon.png'

while this
os.path.normpath(settings.MEDIA_ROOT):

gives:

'\\www\\myproject\\media'

You can see missing Drive name.

Patch is here:
{{{
@@ -576,7 +576,7 @@
         # If the raw path is passed in, validate it's under the MEDIA_ROOT.
         def isWithinMediaRoot(field_data, all_data):
             f = os.path.abspath(os.path.join(settings.MEDIA_ROOT, field_data))
-            if not f.startswith(os.path.normpath(settings.MEDIA_ROOT)):
+            if not f.startswith(os.path.abspath(os.path.normpath(settings.MEDIA_ROOT))):
                 raise validators.ValidationError, _(""Enter a valid filename."")
         field_list[1].validator_list.append(isWithinMediaRoot)
         return field_list
}}}

Pitty I spent a whole day, before I found it."	defect	closed	contrib.admin	dev	normal	fixed			Unreviewed	1	0	0	1	0	0
