I have a file browser application that exposes a directory and its contents to the users.
I want to sanitize the user input, which is a file path, so that it does not allow absolute paths such as '/tmp/' and relative paths such as '../../etc'
Is there a python function that does this across platforms?
Perhaps instead of just cleaning the path (blacklisting) you could only allow (whitelist) a valid path.
python provides a variety of tools in
os.path to do this in an os independent way