While working on #4899 it's apparent to me that we could use rails callbacks like before_action or similar for a few things like validate_path! and parse_path and so on. Using rails conventions like these will help us simplify the controller actions so we don't have to manually code keep track of which action needs to do which thing manually.