def do_GET(self, serv):
    qs = get_qs(serv.path)
    if (('accessToken' not in qs) or (('path' not in qs) and ('id' not in qs))):
        serv.send_error(400)
        return
    tok = qs['accessToken'][0]
    userid = do_auth(tok)
    if (userid == None):
        serv.send_error(401)
        return
    if ('path' in qs):
        fileid = qs['path'][0]
        fileid = urllib.unquote(fileid)
    else:
        fileid = qs['id'][0]
    path = local_to_real(fileid)
    if (not os.path.exists(path)):
        serv.send_error(404)
        return
    st = os.stat(path)
    fname = fileid.replace('\\', '/').strip()
    dir = ''
    if (('/' in fname) and (fname[(- 1)] != '/')):
        dir = fname[:fname.rfind('/')].strip()
        fname = fname[len(dir):]
    while (fname[0] == '/'):
        fname = fname[1:]
    mime = 'unknown'
    if stat.S_ISDIR(st.st_mode):
        mime = FOLDER_MIME
    else:
        pass
    id = fileid_to_publicid(fileid, userid).strip()
    f = {'name': fname, 'id': id, 'parentid': dir, 'mimeType': mime, 'modified': st.st_mtime, 'is_dir': stat.S_ISDIR(st.st_mode)}
    f2 = {}
    for k in f:
        if (k in file_restricted_fields):
            continue
        f2[k] = f[k]
    body = json.dumps(f2)
    body = bstr(body)
    serv.gen_headers('GET', len(body), json_mimetype)
    serv.wfile.write(body)
def do_GET(self, serv):
    qs = get_qs(serv.path)
    if (('accessToken' not in qs) or (('path' not in qs) and ('id' not in qs))):
        serv.send_error(400)
        return
    tok = qs['accessToken'][0]
    userid = do_auth(tok)
    if (userid == None):
        serv.send_error(401)
        return
    if ('path' in qs):
        fileid = qs['path'][0]
        fileid = urllib.unquote(fileid)
    else:
        fileid = qs['id'][0]
    path = local_to_real(fileid)
    if (not os.path.exists(path)):
        serv.send_error(404)
        return
    st = os.stat(path)
    fname = fileid.replace('\\', '/').strip()
    dir = 
    if (('/' in fname) and (fname[(- 1)] != '/')):
        dir = fname[:fname.rfind('/')].strip()
        fname = fname[len(dir):]
    while (fname[0] == '/'):
        fname = fname[1:]
    mime = 'unknown'
    if stat.S_ISDIR(st.st_mode):
        mime = FOLDER_MIME
    else:
        pass
    id = fileid_to_publicid(fileid, userid).strip()
    f = {'name': fname, 'id': id, 'parentid': dir, 'mimeType': mime, 'modified': st.st_mtime, 'is_dir': stat.S_ISDIR(st.st_mode)}
    f2 = {}
    for k in f:
        if (k in file_restricted_fields):
            continue
        f2[k] = f[k]
    body = json.dumps(f2)
    body = bstr(body)
    serv.gen_headers('GET', len(body), json_mimetype)
    serv.wfile.write(body)