[rsp] Fix commit 24e3ac1 so it filters properly (ref issue #944)

This commit is contained in:
ejurgensen 2020-04-28 22:26:25 +02:00
parent 66154ae014
commit 6d9cf5c1d7

View File

@ -210,6 +210,7 @@ static int
query_params_set(struct query_params *qp, struct httpd_request *hreq) query_params_set(struct query_params *qp, struct httpd_request *hreq)
{ {
const char *param; const char *param;
char *filter;
int ret; int ret;
qp->offset = 0; qp->offset = 0;
@ -250,11 +251,15 @@ query_params_set(struct query_params *qp, struct httpd_request *hreq)
if (!qp->filter) if (!qp->filter)
DPRINTF(E_LOG, L_RSP, "Ignoring improper RSP query\n"); 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 else
{ filter = strdup(rsp_filter_files);
// Default filter is to include only files (not streams and Spotify)
qp->filter = strdup(rsp_filter_files); free(qp->filter);
} qp->filter = filter;
return 0; return 0;
} }
@ -422,6 +427,10 @@ rsp_reply_db(struct httpd_request *hreq)
/* Playlists block (all playlists) */ /* Playlists block (all playlists) */
while (((ret = db_query_fetch_pl(&qp, &dbpli)) == 0) && (dbpli.id)) 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) */ /* Playlist block (one playlist) */
pl = mxmlNewElement(pls, "playlist"); pl = mxmlNewElement(pls, "playlist");