Ticket #3018: patch-db-models-fields-filefield.patch
File patch-db-models-fields-filefield.patch, 850 bytes (added by , 18 years ago) |
---|
-
__init__.py
584 584 585 585 # If the raw path is passed in, validate it's under the MEDIA_ROOT. 586 586 def isWithinMediaRoot(field_data, all_data): 587 f = os.path.abspath(os.path.join(se ttings.MEDIA_ROOT, field_data))588 if not f.startswith(os.path.abspath(os.path.normpath(se ttings.MEDIA_ROOT))):587 f = os.path.abspath(os.path.join(self.upload_to or settings.MEDIA_ROOT, field_data)) 588 if not f.startswith(os.path.abspath(os.path.normpath(self.upload_to or settings.MEDIA_ROOT))): 589 589 raise validators.ValidationError, _("Enter a valid filename.") 590 590 field_list[1].validator_list.append(isWithinMediaRoot) 591 591 return field_list