mirror of
https://github.com/appium/appium.git
synced 2026-02-11 04:20:00 -06:00
fix latent javascript replace-with-'' bug
This commit is contained in:
@@ -42,12 +42,16 @@ module.exports.doProxy = function (req, res) {
|
||||
req.device.proxyPort);
|
||||
var sessRe = new RegExp('^/wd/hub/session/([^/]+)');
|
||||
var sessionRegxMatch = sessRe.exec(req.originalUrl);
|
||||
// there might be no session id in the orig. req. if so, consider it to be a
|
||||
// blank string
|
||||
var origSessId = sessionRegxMatch ? sessionRegxMatch[1] : '';
|
||||
var sessId = req.device.proxySessionId ? req.device.proxySessionId :
|
||||
origSessId;
|
||||
var newPath = req.originalUrl.replace(origSessId, sessId);
|
||||
var newPath;
|
||||
// there might be no session id in the orig. req.
|
||||
if (sessionRegxMatch) {
|
||||
var origSessId = sessionRegxMatch[1];
|
||||
var sessId = req.device.proxySessionId ? req.device.proxySessionId :
|
||||
origSessId;
|
||||
newPath = req.originalUrl.replace(origSessId, sessId);
|
||||
} else {
|
||||
newPath = req.originalUrl;
|
||||
}
|
||||
var url = 'http://' + req.device.proxyHost + ':' + req.device.proxyPort +
|
||||
newPath;
|
||||
doRequest(url, req.route.method.toUpperCase(), req.body,
|
||||
|
||||
Reference in New Issue
Block a user