bug 123006 : Keyword substitution with %s doesn't escape characters : patch by jmdesp@alussinan.org (r+sr=neil)

This commit is contained in:
jshin%mailaps.org 2004-10-29 11:30:08 +00:00
Родитель 8c8735f73e
Коммит 3666efba59
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -1467,12 +1467,12 @@ function getShortcutOrURI(url)
var cmd = url.substr(0, aOffset);
var text = url.substr(aOffset+1);
shortcutURL = gBookmarksService.resolveKeyword(cmd);
// Bug 123006 : %s replace and URI escape, %S replace with raw value
if (shortcutURL && text) {
aOffset = shortcutURL.indexOf("%s");
if (aOffset >= 0)
shortcutURL = shortcutURL.substr(0, aOffset) + text + shortcutURL.substr(aOffset+2);
else
shortcutURL = null;
shortcutURL = /%[sS]/.test(shortcutURL) ?
shortcutURL.replace(/%s/g, encodeURIComponent(text))
.replace(/%S/g, text) :
null;
}
}
}