From 5b768b5bdaa8e97579e095ebc69a8acc774d75ca Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 30 Aug 2020 05:42:52 -0400 Subject: [PATCH] JSON blobs were accidentally inserted into DB, stringifying then parsing the video file object fixes this --- backend/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/app.js b/backend/app.js index 50c1248..0cf5be0 100644 --- a/backend/app.js +++ b/backend/app.js @@ -1904,6 +1904,8 @@ app.get('/api/getMp3s', optionalJwt, function(req, res) { playlists = auth_api.getUserPlaylists(req.user.uid, 'audio'); } + mp3s = JSON.parse(JSON.stringify(mp3s)); + // add thumbnails if present mp3s.forEach(mp3 => { if (mp3['thumbnailPath'] && fs.existsSync(mp3['thumbnailPath'])) @@ -1929,6 +1931,8 @@ app.get('/api/getMp4s', optionalJwt, function(req, res) { playlists = auth_api.getUserPlaylists(req.user.uid, 'video'); } + mp4s = JSON.parse(JSON.stringify(mp4s)); + // add thumbnails if present mp4s.forEach(mp4 => { if (mp4['thumbnailPath'] && fs.existsSync(mp4['thumbnailPath'])) @@ -2019,6 +2023,8 @@ app.post('/api/getAllFiles', optionalJwt, function (req, res) { files = files.concat(sub.videos); } + files = JSON.parse(JSON.stringify(files)); + // add thumbnails if present files.forEach(file => { if (file['thumbnailPath'] && fs.existsSync(file['thumbnailPath']))