Intentional trailing slashes should be left alone
This commit is contained in:
Родитель
01a7ccddba
Коммит
466dc52492
|
@ -321,7 +321,8 @@ Notification.prototype.trim = function(length) {
|
|||
return length - tooLong;
|
||||
}
|
||||
escaped = this.truncateStringToLength(escaped, length - tooLong, encoding);
|
||||
escaped = escaped.replace(/(\\+|\\u[0-9a-fA-F]{0,3})$/, "");
|
||||
escaped = escaped.replace(/(\\u[0-9a-fA-F]{0,3})$/, "");
|
||||
escaped = escaped.replace(/([^\\])\\$/, "$1");
|
||||
|
||||
var trimmed = Buffer.byteLength(escaped, encoding);
|
||||
escaped = JSON.parse("\"" + escaped + "\"");
|
||||
|
|
|
@ -143,9 +143,15 @@ describe("Notification", function() {
|
|||
expect(note.alert).to.equal("\n\n");
|
||||
});
|
||||
|
||||
it("strips orphaned escape character", function () {
|
||||
it("leaves escaped escape character intact", function() {
|
||||
note.alert = "test\\ message";
|
||||
note.trim(26);
|
||||
expect(note.alert).to.equal("test\\");
|
||||
});
|
||||
|
||||
it("strips orphaned escape character", function () {
|
||||
note.alert = "test\\ message";
|
||||
note.trim(25);
|
||||
expect(note.alert).to.equal("test");
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче