media/tools/constrained_network_server/cns.py
def _CheckFileExistOnServer(self, f):
    """Checks if requested file f exists to be served by this server."""
    # Sanitize and check the path to prevent www-root escapes.
    sanitized_path = os.path.abspath(os.path.join(self._options.www_root, f))
    if not sanitized_path.startswith(self._options.www_root):
      raise cherrypy.HTTPError(403, 'Invalid file requested.')
    if not os.path.exists(sanitized_path):
      raise cherrypy.HTTPError(404, 'File not found.')
Checks if requested file f exists to be served by this server.
Checks if requested file f exists to be served by this server.
Checks if requested file f exists to be served by this server .
def _CheckFileExistOnServer(self, f):
    sanitized_path = os.path.abspath(os.path.join(self._options.www_root, f))
    if not sanitized_path.startswith(self._options.www_root):
      raise cherrypy.HTTPError(403, 'Invalid file requested.')
    if not os.path.exists(sanitized_path):
      raise cherrypy.HTTPError(404, 'File not found.')
def _CheckFileExistOnServer ( self , f ) : sanitized_path = os . path . abspath ( os . path . join ( self . _options . www_root , f ) ) if not sanitized_path . startswith ( self . _options . www_root ) : raise cherrypy . HTTPError ( 403 , 'Invalid file requested.' ) if not os . path . exists ( sanitized_path ) : raise cherrypy . HTTPError ( 404 , 'File not found.' )
Checks if requested file f exists to be served by this server.
Checks if requested file f exists to be served by this server .
"""Checks if requested file f exists to be served by this server.""" # Sanitize and check the path to prevent www-root escapes.
self
f