def publicid_to_fileid(publicid):
    if (len(publicid) == 17):
        (userid, fileid) = fileapi_db.publicid_to_fileid(publicid)
        if (fileid == ROOT_PARENT_ID):
            return '/'
    if (publicid == '/'):
        return publicid
    path = base64.b64decode(bytes(publicid, 'latin-1'))
    path = str(path, 'latin-1')
    if ('..' in path):
        return '-1'
    return path
def publicid_to_fileid(publicid):
    if (len(publicid) == 17):
        (userid, fileid) = fileapi_db.publicid_to_fileid(publicid)
        if (fileid == ROOT_PARENT_ID):
            return '/'
    if (publicid == '/'):
        return publicid
    path = base64.b64decode(bytes(publicid, 'latin-1'))
    path = str(path, 'latin-1')
    if ('..' in path):
        return '-1'
    return path