小调整。

release-2.0.0.2
王良 2025-04-29 17:15:26 +08:00
parent 5941c25ba9
commit bdcff4a1cc
2 changed files with 5 additions and 14 deletions

View File

@ -92,9 +92,9 @@ module.exports = {
// 如果未手动配置需要缓存,则不允许使用缓存
const maxAge = cacheReq.getMaxAge(interceptOpt)
if (maxAge == null || maxAge <= 0) {
replaceHeaders['cache-control'] = '[remove]'
replaceHeaders['last-modified'] = '[remove]'
replaceHeaders.expires = '[remove]'
replaceHeaders['cache-control'] = REMOVE
replaceHeaders['last-modified'] = REMOVE
replaceHeaders.expires = REMOVE
}
actions += `${actions ? ',' : ''}download:${filename}`

View File

@ -1,5 +1,6 @@
const lodash = require('lodash')
const log = require('./util.log.server')
const mergeApi = require('@docmirror/dev-sidecar/src/merge')
function isMatched (url, regexp) {
if (regexp === '.*' || regexp === '*' || regexp === 'true' || regexp === true) {
@ -113,16 +114,6 @@ function merge (oldObj, newObj) {
}
})
}
function deleteNullItems (target) {
lodash.forEach(target, (item, key) => {
if (item == null || item === '[delete]') {
delete target[key]
}
if (lodash.isObject(item)) {
deleteNullItems(item)
}
})
}
function matchHostnameAll (hostMap, hostname, action) {
// log.debug('matchHostname-all:', action, hostMap)
@ -178,7 +169,7 @@ function matchHostnameAll (hostMap, hostname, action) {
}
if (!lodash.isEmpty(values)) {
deleteNullItems(values)
mergeApi.deleteNullItems(values)
log.info(`matchHostname-all: ${action}: '${hostname}':`, JSON.stringify(values))
return values
} else {