@samitouri / QOSami-HFS / commits / 8ede08b8

fix: in case a plugin did return a 304 "use cache" response, this was overwritten (happened with file-icons plugin)

Massimo Melina committed Jan 6, 2024 at 13:28 UTC 8ede08b805e9ad1a9a9a63e00dccba919ff7c8e4
1 file changed +3 -2
src/plugins.ts
+3 -2
@@ -3,7 +3,8 @@
3 import glob from 'fast-glob'
4 import { watchLoad } from './watchLoad'
5 import _ from 'lodash'
6 -import { API_VERSION, APP_PATH, COMPATIBLE_API_VERSION, IS_WINDOWS, MIME_AUTO, PLUGINS_PUB_URI } from './const'
6 +import { API_VERSION, APP_PATH, COMPATIBLE_API_VERSION, HTTP_NOT_FOUND, IS_WINDOWS, MIME_AUTO,
7 + PLUGINS_PUB_URI } from './const'
8 import * as Const from './const'
9 import Koa from 'koa'
10 import { adjustStaticPathForGlob, Callback, debounceAsync, Dict, getOrSet, onlyTruthy, onProcessExit,
@@ -132,7 +133,7 @@ export const pluginsMiddleware: Koa.Middleware = async (ctx, next) => {
133 await serveFile(ctx, plugins[name]!.folder + '/public/' + a.join('/'), MIME_AUTO)
134 return
135 }
135 - if (!ctx.body)
136 + if (ctx.body === undefined && ctx.status === HTTP_NOT_FOUND) // no response was provided by plugins, so we'll do
137 await next()
138 }
139 for (const [id,f] of Object.entries(after))