mercurial/hgweb/common.py
changeset 45306 9a5c4875a88c
parent 43793 29adf0a087a1
child 45378 dc9fe90bdbd5
equal deleted inserted replaced
45305:e2320bb7a99f 45306:9a5c4875a88c
   189     """
   189     """
   190     if not ispathsafe(fname):
   190     if not ispathsafe(fname):
   191         return
   191         return
   192 
   192 
   193     fpath = os.path.join(*fname.split(b'/'))
   193     fpath = os.path.join(*fname.split(b'/'))
   194     if isinstance(directory, bytes):
   194     path = os.path.join(directory, fpath)
   195         directory = [directory]
       
   196     for d in directory:
       
   197         path = os.path.join(d, fpath)
       
   198         if os.path.exists(path):
       
   199             break
       
   200     try:
   195     try:
   201         os.stat(path)
   196         os.stat(path)
   202         ct = pycompat.sysbytes(
   197         ct = pycompat.sysbytes(
   203             mimetypes.guess_type(pycompat.fsdecode(path))[0] or r"text/plain"
   198             mimetypes.guess_type(pycompat.fsdecode(path))[0] or r"text/plain"
   204         )
   199         )