Browse Source

fix: import playlist never finishes

Kristian Vos 1 year ago
parent
commit
99a84989e8
2 changed files with 7 additions and 3 deletions
  1. 3 3
      backend/logic/actions/playlists.js
  2. 4 0
      backend/logic/media.js

+ 3 - 3
backend/logic/actions/playlists.js

@@ -1513,9 +1513,9 @@ export default {
 							if (!playlist) return next("Playlist not found.");
 							if (playlist.createdBy !== session.userId)
 								return hasPermission("playlists.songs.add", session)
-									.then(() => next(null, playlist))
+									.then(() => next())
 									.catch(() => next("Invalid permissions."));
-							return next(null, playlist);
+							return next();
 						})
 						.catch(next);
 				},
@@ -1554,7 +1554,7 @@ export default {
 						.catch(next);
 				},
 
-				(nothing, next) => {
+				next => {
 					async.eachLimit(
 						mediaSources,
 						1,

+ 4 - 0
backend/logic/media.js

@@ -384,6 +384,10 @@ class _MediaModule extends CoreClass {
 								this
 							)
 								.then(response => {
+									if (response.videos.length === 0) {
+										next("Media not found.");
+										return;
+									}
 									const { youtubeId, title, author, duration } = response.videos[0];
 									next(null, song, {
 										mediaSource: `youtube:${youtubeId}`,