首页 > 技术文章 > 解决百度UEditor列出图片列出文件时返回的文件路径为磁盘绝对路径的问题

Leechg 2019-05-23 16:45 原文

 

替换绝对路径为空

 String str = new ActionEnter(request, buffer.toString(), "config.json").exec();
        String action = request.getParameter("action");
        String rootPath =buffer.toString();
        if( action!=null && (action.equals("listfile") || action.equals("listimage") ) ){
            rootPath = rootPath.replace("\\", "/");
            rootPath = rootPath.replace("//", "/");
            str = str.replaceAll(rootPath, "");
        }
        JSONObject json =JSONObject.parseObject(str);

 

推荐阅读