diff --git a/src/models/Track.js b/src/models/Track.js index 738c5ee..fa89ff7 100644 --- a/src/models/Track.js +++ b/src/models/Track.js @@ -59,7 +59,7 @@ schema.pre('validate', async function (next) { class Track extends mongoose.Model { slugify() { - this.slug = slug(this.title) + '-' + ((Math.random() * Math.pow(36, 6)) | 0).toString(36); + this.slug = slug(this.title || 'track') + '-' + ((Math.random() * Math.pow(36, 6)) | 0).toString(36); } async generateOriginalFilePath() {