fix: do not error when generating slug if not track title is present

This commit is contained in:
Paul Bienkowski 2021-02-17 19:43:10 +01:00
parent 7fec413437
commit af1e186069

View file

@ -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() {