vona-core 5.1.39 → 5.1.40

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 CHANGED
@@ -2287,16 +2287,18 @@ const contextBase = {
2287
2287
  if (self.accepts('html', 'text', 'json') === 'json') return true;
2288
2288
  return false;
2289
2289
  },
2290
- redirect(url, status) {
2290
+ redirect(url, statusOrOptions) {
2291
2291
  const self = cast(this);
2292
+ const options = typeof statusOrOptions === 'number' ? {
2293
+ status: statusOrOptions
2294
+ } : statusOrOptions ?? {};
2292
2295
  // checkOrigin
2293
- if (!url.startsWith('/')) {
2296
+ if (!url.startsWith('/') && !options.trustedExternal) {
2294
2297
  const origin = cast(self.app.bean).security.checkOrigin(url, self.host);
2295
2298
  if (!origin) self.app.throw(403);
2296
2299
  }
2297
2300
  // throw
2298
- status = status ?? 302;
2299
- self.app.throw(status, url);
2301
+ self.app.throw(options.status ?? 302, url);
2300
2302
  }
2301
2303
  };
2302
2304