Skip to content

Commit

Permalink
Fix incorrect suffix check (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
lexie011 authored Jan 2, 2025
1 parent 47eaa4c commit fde5457
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ function findCordovaPath () {
var term = '/cordova.js';
for (var n = scripts.length - 1; n > -1; n--) {
var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
if (src.indexOf(term) === (src.length - term.length)) {
if (src.indexOf(term) === (src.length - term.length) && src.indexOf(term) > -1 && (src.length - term.length > -1)) {
path = src.substring(0, src.length - term.length) + '/';
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ function findCordovaPath () {
var term = '/cordova.js';
for (var n = scripts.length - 1; n > -1; n--) {
var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
if (src.indexOf(term) === (src.length - term.length)) {
if (src.indexOf(term) === (src.length - term.length) && src.indexOf(term) > -1 && (src.length - term.length > -1)) {
path = src.substring(0, src.length - term.length) + '/';
break;
}
Expand Down

0 comments on commit fde5457

Please sign in to comment.