mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03:00
Merge pull request #1885 from nicovalencia/issue-1880
Add `rss` to the list of reserved post titles/slugs.
This commit is contained in:
commit
b6edc870aa
@ -227,7 +227,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
// Remove non ascii characters
|
||||
slug = unidecode(slug);
|
||||
// Check the filtered slug doesn't match any of the reserved keywords
|
||||
slug = /^(ghost|ghost\-admin|admin|wp\-admin|wp\-login|dashboard|logout|login|signin|signup|signout|register|archive|archives|category|categories|tag|tags|page|pages|post|posts|user|users)$/g
|
||||
slug = /^(ghost|ghost\-admin|admin|wp\-admin|wp\-login|dashboard|logout|login|signin|signup|signout|register|archive|archives|category|categories|tag|tags|page|pages|post|posts|user|users|rss)$/g
|
||||
.test(slug) ? slug + '-post' : slug;
|
||||
|
||||
//if slug is empty after trimming use "post"
|
||||
|
@ -255,6 +255,18 @@ describe('Post Model', function () {
|
||||
}).then(null, done);
|
||||
});
|
||||
|
||||
it('can generate a safe slug when a reserved keyword is used', function(done) {
|
||||
var newPost = {
|
||||
title: 'rss',
|
||||
markdown: 'Test Content 1'
|
||||
};
|
||||
|
||||
PostModel.add(newPost).then(function (createdPost) {
|
||||
createdPost.get('slug').should.not.equal('rss');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can generate slugs without non-ascii characters', function (done) {
|
||||
var newPost = {
|
||||
title: 'भुते धडकी भरवणारा आहेत',
|
||||
|
Loading…
Reference in New Issue
Block a user