From 026bf16e0c4e5db73e9fc35e175aa78eccc4a00c Mon Sep 17 00:00:00 2001 From: Alexandr Date: Sat, 25 May 2024 21:13:40 +0300 Subject: [PATCH] fixed `read properties of undefined (reading 'replace')` inside relative func --- lib/util.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/util.js b/lib/util.js index 35bd93d6..b4486ef4 100644 --- a/lib/util.js +++ b/lib/util.js @@ -247,8 +247,9 @@ exports.isAbsolute = function(aPath) { * @param aRoot The root path or URL. * @param aPath The path or URL to be made relative to aRoot. */ -function relative(aRoot, aPath) { - if (aRoot === "") { +function relative(aRoot, aPath) { + + if (typeof aRoot == 'undefined' || aRoot === "") { aRoot = "."; }