app/grandchallenge/components/validators.py
def validate_safe_path(value):
    """Ensures that the path is safe and normalised."""
    base = "/input/"

    try:
        new_path = safe_join(base, value)
    except SuspiciousFileOperation:
        raise ValidationError("Relative paths are not allowed.")

    valid_path = new_path[len(base) :]

    if value != valid_path:
        raise ValidationError(f"Invalid file path, should be {valid_path}.")
Ensures that the path is safe and normalised.
Ensures that the path is safe and normalised.
Ensures that the path is safe and normalised .
def validate_safe_path(value):
    base = "/input/"
    try:
        new_path = safe_join(base, value)
    except SuspiciousFileOperation:
        raise ValidationError("Relative paths are not allowed.")
    valid_path = new_path[len(base) :]
    if value != valid_path:
        raise ValidationError(f"Invalid file path, should be {valid_path}.")
def validate_safe_path ( value ) : base = "/input/" try : new_path = safe_join ( base , value ) except SuspiciousFileOperation : raise ValidationError ( "Relative paths are not allowed." ) valid_path = new_path [ len ( base ) : ] if value != valid_path : raise ValidationError ( f"Invalid file path, should be {valid_path}." )
Ensures that the path is safe and normalised.
Ensures that the path is safe and normalised .
"""Ensures that the path is safe and normalised."""
value