From 6d9cf5c1d71f0ede107a6f10d16c3f81d9a1e330 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 28 Apr 2020 22:26:25 +0200 Subject: [PATCH] [rsp] Fix commit 24e3ac1 so it filters properly (ref issue #944) --- src/httpd_rsp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/httpd_rsp.c b/src/httpd_rsp.c index c732d22e..73a01452 100644 --- a/src/httpd_rsp.c +++ b/src/httpd_rsp.c @@ -210,6 +210,7 @@ static int query_params_set(struct query_params *qp, struct httpd_request *hreq) { const char *param; + char *filter; int ret; qp->offset = 0; @@ -250,11 +251,15 @@ query_params_set(struct query_params *qp, struct httpd_request *hreq) if (!qp->filter) DPRINTF(E_LOG, L_RSP, "Ignoring improper RSP query\n"); } + + // Always filter to include only files (not streams and Spotify) + if (qp->filter) + filter = safe_asprintf("%s AND %s", qp->filter, rsp_filter_files); else - { - // Default filter is to include only files (not streams and Spotify) - qp->filter = strdup(rsp_filter_files); - } + filter = strdup(rsp_filter_files); + + free(qp->filter); + qp->filter = filter; return 0; } @@ -422,6 +427,10 @@ rsp_reply_db(struct httpd_request *hreq) /* Playlists block (all playlists) */ while (((ret = db_query_fetch_pl(&qp, &dbpli)) == 0) && (dbpli.id)) { + // Skip non-local playlists, can't be streamed to the device + if (!dbpli.path || dbpli.path[0] != '/') + continue; + /* Playlist block (one playlist) */ pl = mxmlNewElement(pls, "playlist");