koa 3.0.1 → 3.0.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/lib/response.js +3 -7
- package/package.json +1 -1
package/lib/response.js
CHANGED
|
@@ -322,12 +322,6 @@ module.exports = {
|
|
|
322
322
|
back (alt) {
|
|
323
323
|
const referrer = this.ctx.get('Referrer')
|
|
324
324
|
if (referrer) {
|
|
325
|
-
// referrer is a relative path
|
|
326
|
-
if (referrer.startsWith('/')) {
|
|
327
|
-
this.redirect(referrer)
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
|
|
331
325
|
// referrer is an absolute URL, check if it's the same origin
|
|
332
326
|
const url = new URL(referrer, this.ctx.href)
|
|
333
327
|
if (url.host === this.ctx.host) {
|
|
@@ -351,7 +345,9 @@ module.exports = {
|
|
|
351
345
|
*/
|
|
352
346
|
|
|
353
347
|
attachment (filename, options) {
|
|
354
|
-
if (filename
|
|
348
|
+
if (filename && !this.has('Content-Type')) {
|
|
349
|
+
this.type = extname(filename)
|
|
350
|
+
}
|
|
355
351
|
this.set('Content-Disposition', contentDisposition(filename, options))
|
|
356
352
|
},
|
|
357
353
|
|