Skip to content

Commit

Permalink
Fixed migration for failed slug strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaumRystra committed Jul 13, 2017
1 parent 35b6fe2 commit a411fb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rpg-docs/Model/Character/Characters.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ if (Meteor.isServer){
});
Characters.after.update(function(userId, doc, fieldNames, modifier, options) {
if (_.contains(fieldNames, "name")){
var urlName = getSlug(doc.name, {maintainCase: true});
var urlName = getSlug(doc.name, {maintainCase: true}) || "-";
Characters.update(doc._id, {$set: {urlName}});
}
});
Expand Down
2 changes: 1 addition & 1 deletion rpg-docs/server/migrations/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Migrations.add({
//update characters
Characters.find({}).forEach(function(char){
if (char.urlName) return;
var urlName = getSlug(char.name, {maintainCase: true});
var urlName = getSlug(char.name, {maintainCase: true}) || "-";
Characters.update(char._id, {$set: {urlName}});
});
},
Expand Down

0 comments on commit a411fb2

Please sign in to comment.