Ticket #6635: 6635.patch

File 6635.patch, 713 bytes (added by justin.driscoll@…, 17 years ago)

Strip forward slash from "field_data" in "isWithinMediaRoot".

  • __init__.py

     
    750750
    751751        # If the raw path is passed in, validate it's under the MEDIA_ROOT.
    752752        def isWithinMediaRoot(field_data, all_data):
    753             f = os.path.abspath(os.path.join(settings.MEDIA_ROOT, field_data))
     753            f = os.path.abspath(os.path.join(settings.MEDIA_ROOT, field_data.strip('/')))
    754754            if not f.startswith(os.path.abspath(os.path.normpath(settings.MEDIA_ROOT))):
    755755                raise validators.ValidationError, _("Enter a valid filename.")
    756756        field_list[1].validator_list.append(isWithinMediaRoot)
Back to Top