From f1090d749e2f2ca7050cca50cfcfc0587b291bc6 Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Sat, 8 Oct 2016 09:06:30 -0400 Subject: [PATCH] Fix str.length strEndsWith bug (#2572) This was some how missed in dev testing I guess. @buggyj suggested this. Should fix #2571 --- core/modules/utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index 2d599eac3..94c08f329 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -718,7 +718,7 @@ exports.strEndsWith = function(str,ending,position) { if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) { position = str.length; } - position -= str.length; + position -= ending.length; var lastIndex = str.indexOf(ending, position); return lastIndex !== -1 && lastIndex === position; }