From a411fb2b430b127c8696ccf4317fa8b29bfbfd35 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 13 Jul 2017 16:44:23 +0200 Subject: [PATCH] Fixed migration for failed slug strings --- rpg-docs/Model/Character/Characters.js | 2 +- rpg-docs/server/migrations/migrations.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js index b16e3324a..f8a2d33f9 100644 --- a/rpg-docs/Model/Character/Characters.js +++ b/rpg-docs/Model/Character/Characters.js @@ -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}}); } }); diff --git a/rpg-docs/server/migrations/migrations.js b/rpg-docs/server/migrations/migrations.js index 641a98aea..34e734140 100644 --- a/rpg-docs/server/migrations/migrations.js +++ b/rpg-docs/server/migrations/migrations.js @@ -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}}); }); },