waibu 2.11.2 → 2.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -2
- package/lib/handle-not-found.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +5 -0
package/index.js
CHANGED
|
@@ -242,8 +242,12 @@ async function factory (pkgName) {
|
|
|
242
242
|
* @param {string} text
|
|
243
243
|
* @returns {string}
|
|
244
244
|
*/
|
|
245
|
-
escape = (text
|
|
246
|
-
|
|
245
|
+
escape = (text) => {
|
|
246
|
+
const { isSet } = this.app.lib.aneka
|
|
247
|
+
const { isArray, isPlainObject, cloneDeep } = this.app.lib._
|
|
248
|
+
if (!isSet(text)) return ''
|
|
249
|
+
if (isArray(text) || isPlainObject(text)) text = JSON.stringify(cloneDeep(text))
|
|
250
|
+
else text = text + ''
|
|
247
251
|
const { forOwn } = this.app.lib._
|
|
248
252
|
forOwn(this.escapeChars, (v, k) => {
|
|
249
253
|
text = text.replaceAll(k, v)
|
package/lib/handle-not-found.js
CHANGED
|
@@ -64,7 +64,7 @@ export async function notFound (err, req, reply) {
|
|
|
64
64
|
reply.code(404)
|
|
65
65
|
const resp = await interceptor.call(this, 'notFoundHandler', err, req, reply)
|
|
66
66
|
if (resp) return resp
|
|
67
|
-
if (err.noContent) return ''
|
|
67
|
+
if (err && err.noContent) return ''
|
|
68
68
|
const payload = {
|
|
69
69
|
text: req.t('notFound%s%s', req.t('route'), req.url),
|
|
70
70
|
title: req.t('pageNotFound')
|
package/package.json
CHANGED