diff --git a/backend/middlewares/GalleryMWs.ts b/backend/middlewares/GalleryMWs.ts index 61154d16..62db87d1 100644 --- a/backend/middlewares/GalleryMWs.ts +++ b/backend/middlewares/GalleryMWs.ts @@ -97,7 +97,9 @@ export class GalleryMWs { if (cw.directory) { const removeVideos = (dir: DirectoryDTO) => { dir.media = dir.media.filter(m => !MediaDTO.isVideo(m)); - dir.directories.forEach(d => removeVideos(d)); + if (dir.directories) { + dir.directories.forEach(d => removeVideos(d)); + } }; removeVideos(cw.directory); }