Split only on first comma in media browser (#12331)

This commit is contained in:
Paulus Schoutsen 2022-04-14 15:52:49 -07:00 committed by GitHub
parent 30b130ca74
commit 7723d47ac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,11 +170,12 @@ class PanelMediaBrowser extends LitElement {
media_content_id: undefined, media_content_id: undefined,
}, },
...navigateIdsEncoded.map((navigateId) => { ...navigateIdsEncoded.map((navigateId) => {
const [media_content_type, media_content_id] = const decoded = decodeURIComponent(navigateId);
decodeURIComponent(navigateId).split(","); // Don't use split because media_content_id could contain commas
const delimiter = decoded.indexOf(",");
return { return {
media_content_type, media_content_type: decoded.substring(0, delimiter),
media_content_id, media_content_id: decoded.substring(delimiter + 1),
}; };
}), }),
]; ];