vona-module-a-static 5.0.23 → 5.0.24
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/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,7 +118,11 @@ async function _getFullPathInner(ctx, dir, filename, options) {
|
|
|
118
118
|
// trim prefix
|
|
119
119
|
if (options.apiStaticPrefix !== '/') {
|
|
120
120
|
const filePrefix = path.normalize(options.apiStaticPrefix.replace(/^\//, ''));
|
|
121
|
-
if (filename.indexOf(filePrefix) !== 0)
|
|
121
|
+
if (filename.indexOf(filePrefix) !== 0) {
|
|
122
|
+
return;
|
|
123
|
+
// cannot throw error
|
|
124
|
+
// throw new Error(`invalid filename: ${filename}`);
|
|
125
|
+
}
|
|
122
126
|
filename = filename.slice(filePrefix.length);
|
|
123
127
|
}
|
|
124
128
|
// check
|
|
@@ -134,7 +138,11 @@ async function _getFullPathInner(ctx, dir, filename, options) {
|
|
|
134
138
|
// static
|
|
135
139
|
const moduleRelativeName = `${wordFirst}-${parts.shift()}`;
|
|
136
140
|
const module = ctx.app.meta.modules[moduleRelativeName];
|
|
137
|
-
if (!module)
|
|
141
|
+
if (!module) {
|
|
142
|
+
return;
|
|
143
|
+
// cannot throw error
|
|
144
|
+
// throw new Error(`invalid filename: ${filename}`);
|
|
145
|
+
}
|
|
138
146
|
const fullPath = ctx.app.util.getAssetPathPhysical(moduleRelativeName, 'static', parts.join(path.sep));
|
|
139
147
|
return fullPath;
|
|
140
148
|
}
|