koa 2.15.1 → 2.15.3
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/History.md +12 -0
- package/lib/response.js +2 -1
- package/package.json +1 -1
package/History.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
2.15.3 / 2024-04-11
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
**fixes**
|
|
6
|
+
* [[`1fad597`](http://github.com/koajs/koa/commit/1fad5974dc2b7c5baef3e7438679911826ec7398)] - fix: require URL from 'url' module (#1809) (fengmk2 <<suqian.yf@antgroup.com>>)
|
|
7
|
+
|
|
8
|
+
2.15.2 / 2024-03-21
|
|
9
|
+
==================
|
|
10
|
+
|
|
11
|
+
**fixes**
|
|
12
|
+
* [[`94e8def`](http://github.com/koajs/koa/commit/94e8def4bf6a2bdabe96583de989f03d75106648)] - fix: handle upper case protocol like HTTP or HTTPS (#1806) (fengmk2 <<suqian.yf@antgroup.com>>)
|
|
13
|
+
|
|
2
14
|
2.15.1 / 2024-03-15
|
|
3
15
|
==================
|
|
4
16
|
|
package/lib/response.js
CHANGED
|
@@ -19,6 +19,7 @@ const only = require('only');
|
|
|
19
19
|
const util = require('util');
|
|
20
20
|
const encodeUrl = require('encodeurl');
|
|
21
21
|
const Stream = require('stream');
|
|
22
|
+
const URL = require('url').URL;
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Prototype.
|
|
@@ -261,7 +262,7 @@ module.exports = {
|
|
|
261
262
|
redirect(url, alt) {
|
|
262
263
|
// location
|
|
263
264
|
if ('back' === url) url = this.ctx.get('Referrer') || alt || '/';
|
|
264
|
-
if (
|
|
265
|
+
if (/^https?:\/\//i.test(url)) {
|
|
265
266
|
// formatting url again avoid security escapes
|
|
266
267
|
url = new URL(url).toString();
|
|
267
268
|
}
|