芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/node_modules/strapi/lib/middlewares/public/serve-static.js
'use strict'; const path = require('path'); const koaStatic = require('koa-static'); // serveStatic is not supposed to be used to serve a folder that have sub-folders const serveStatic = (filesDir, koaStaticOptions = {}) => { const serve = koaStatic(filesDir, koaStaticOptions); return async (ctx, next) => { const prev = ctx.path; const newPath = path.basename(ctx.path); ctx.path = newPath; await serve(ctx, async () => { ctx.path = prev; await next(); ctx.path = newPath; }); ctx.path = prev; }; }; module.exports = serveStatic;