Merge branch 'hotfix/0.7.4.1'
This commit is contained in:
commit
aa6f4d46c9
4 changed files with 21 additions and 8 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
# 0.7.4.1
|
||||||
|
|
||||||
|
Fixes a possible cross-site scripting issue with maliciously crafted OpenGraph metadata.
|
||||||
|
|
||||||
# 0.7.4.0
|
# 0.7.4.0
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
(function() {
|
(function() {
|
||||||
app.helpers.truncate = function(passedString, length) {
|
app.helpers.truncate = function(passedString, length) {
|
||||||
if (passedString === null || passedString === undefined) {
|
if (passedString === null || passedString === undefined || passedString.length < length) {
|
||||||
return passedString;
|
return passedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passedString.length > length) {
|
var lastBlank = passedString.lastIndexOf(" ", length);
|
||||||
var lastBlank = passedString.lastIndexOf(' ', length);
|
var trimstring = passedString.substring(0, Math.min(length, lastBlank));
|
||||||
var trimstring = passedString.substring(0, Math.min(length, lastBlank));
|
return trimstring + " ...";
|
||||||
return new Handlebars.SafeString(trimstring + " ...");
|
|
||||||
}
|
|
||||||
return new Handlebars.SafeString(passedString);
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
version:
|
version:
|
||||||
number: "0.7.4.0" # Do not touch unless doing a release, do not backport the version number that's in master
|
number: "0.7.4.1" # Do not touch unless doing a release, do not backport the version number that's in master
|
||||||
heroku: false
|
heroku: false
|
||||||
environment:
|
environment:
|
||||||
url: "http://localhost:3000/"
|
url: "http://localhost:3000/"
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,16 @@ describe("app.helpers.truncate", function() {
|
||||||
it("handles undefined", function() {
|
it("handles undefined", function() {
|
||||||
expect(app.helpers.truncate(undefined, 123)).toEqual(undefined);
|
expect(app.helpers.truncate(undefined, 123)).toEqual(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("returns a short string", function() {
|
||||||
|
expect(app.helpers.truncate("Some text", 10)).toEqual("Some text");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("trims a long string at a space", function() {
|
||||||
|
expect(app.helpers.truncate("Some very long text", 10)).toEqual("Some very ...");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns a string", function() {
|
||||||
|
expect(typeof app.helpers.truncate("Some very long text", 10)).toEqual("string");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue