From 9d815c58b8e9bfbb83086f7ccface419483eba5f Mon Sep 17 00:00:00 2001 From: muxator Date: Tue, 14 Aug 2018 19:45:03 +0200 Subject: [PATCH] deprecations: get rid of DEP0005 about Buffer() Similar code still lives in some dependent libraries. It will be updated when upgrading the dependencies. Fixes #3446 --- src/node/hooks/express/webaccess.js | 2 +- src/node/utils/caching_middleware.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/hooks/express/webaccess.js b/src/node/hooks/express/webaccess.js index 4cb4b9d3e..fd3a579de 100644 --- a/src/node/hooks/express/webaccess.js +++ b/src/node/hooks/express/webaccess.js @@ -33,7 +33,7 @@ exports.basicAuth = function (req, res, next) { var authenticate = function (cb) { // If auth headers are present use them to authenticate... if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) { - var userpass = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString().split(":") + var userpass = Buffer.from(req.headers.authorization.split(' ')[1], 'base64').toString().split(":") var username = userpass.shift(); var password = userpass.join(':'); var fallback = function(success) { diff --git a/src/node/utils/caching_middleware.js b/src/node/utils/caching_middleware.js index 8df6d0b4f..c01a95fb3 100644 --- a/src/node/utils/caching_middleware.js +++ b/src/node/utils/caching_middleware.js @@ -49,7 +49,7 @@ CachingMiddleware.prototype = new function () { (req.get('Accept-Encoding') || '').indexOf('gzip') != -1; var path = require('url').parse(req.url).path; - var cacheKey = (new Buffer(path)).toString('base64').replace(/[/+=]/g, ''); + var cacheKey = Buffer.from(path).toString('base64').replace(/[/+=]/g, ''); fs.stat(CACHE_DIR + 'minified_' + cacheKey, function (error, stats) { var modifiedSince = (req.headers['if-modified-since']