fix for -1 reference handling

This commit is contained in:
aj 2019-09-12 09:59:00 +01:00
parent 13ebc8a1e8
commit 435f16b779

View File

@ -103,6 +103,7 @@ def playlist():
playlist_references = [] playlist_references = []
if request_json.get('playlist_references', None): if request_json.get('playlist_references', None):
if request_json['playlist_references'] != -1:
for i in request_json['playlist_references']: for i in request_json['playlist_references']:
retrieved_ref = database.get_user_playlist_ref_by_user_ref(user_ref, i) retrieved_ref = database.get_user_playlist_ref_by_user_ref(user_ref, i)
if retrieved_ref: if retrieved_ref:
@ -110,7 +111,7 @@ def playlist():
else: else:
return jsonify({"message": f'managed playlist {i} not found', "status": "error"}), 400 return jsonify({"message": f'managed playlist {i} not found', "status": "error"}), 400
if len(playlist_references) == 0: if len(playlist_references) == 0 and request_json.get('playlist_references', None) != -1:
playlist_references = None playlist_references = None
playlist_id = request_json.get('id', None) playlist_id = request_json.get('id', None)