Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Merge commit from fork
Co-authored-by: Chris de Almeida <[email protected]>
  • Loading branch information
UlisesGascon and ctcpip committed Sep 10, 2024
commit a56a6866b2cde1652bbe607b747cd8e1b31b12bc
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ function createRedirectDirectoryListener () {

// reformat the URL
var loc = encodeUrl(url.format(originalUrl))
var doc = createHtmlDocument('Redirecting', 'Redirecting to <a href="' + escapeHtml(loc) + '">' +
escapeHtml(loc) + '</a>')
var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + escapeHtml(loc))

// send redirect response
res.statusCode = 301
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ describe('serveStatic()', function () {
request(server)
.get('/users')
.expect('Location', '/users/')
.expect(301, /<a href="\/users\/">/, done)
.expect(301, /\/users\//, done)
})

it('should redirect directories with query string', function (done) {
Expand All @@ -505,7 +505,7 @@ describe('serveStatic()', function () {
.get('/snow')
.expect('Location', '/snow%20%E2%98%83/')
.expect('Content-Type', /html/)
.expect(301, />Redirecting to <a href="\/snow%20%E2%98%83\/">\/snow%20%E2%98%83\/<\/a></, done)
.expect(301, />Redirecting to \/snow%20%E2%98%83\/</, done)
})

it('should respond with default Content-Security-Policy', function (done) {
Expand Down