(self, filename)
return False
Check if file prefix falls under valid prefixes
Check if file prefix falls under valid prefixes
Check if file prefix falls under valid prefixes
def _is_safe_prefix(self, filename):
        """Check if file prefix falls under valid prefixes"""
        filename = os.path.realpath(filename)
        if os.path.isdir(filename):
            filename += '/'
        for safe_prefix in FileUtil.safe_prefixes:
            if filename.startswith(safe_prefix):
                return True
            if filename.startswith(os.path.realpath(safe_prefix)):
                return True
        return False
def _is_safe_prefix ( self , filename ) : filename = os . path . realpath ( filename ) if os . path . isdir ( filename ) : filename += '/' for safe_prefix in FileUtil . safe_prefixes : if filename . startswith ( safe_prefix ) : return True if filename . startswith ( os . path . realpath ( safe_prefix ) ) : return True return False