mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Allow commas in state of history download (#20088)
Allow commas and quotes in state of history download
This commit is contained in:
parent
94d56367fc
commit
869ace74ad
@ -738,7 +738,10 @@ class HaPanelHistory extends SubscribeMixin(LitElement) {
|
|||||||
for (const timeline of this._mungedStateHistory.timeline) {
|
for (const timeline of this._mungedStateHistory.timeline) {
|
||||||
const entityId = timeline.entity_id;
|
const entityId = timeline.entity_id;
|
||||||
for (const s of timeline.data) {
|
for (const s of timeline.data) {
|
||||||
csv.push(`${entityId},${s.state},${formatDate(s.last_changed)}\n`);
|
const safeState = /,|"/.test(s.state)
|
||||||
|
? `"${s.state.replaceAll('"', '""')}"`
|
||||||
|
: s.state;
|
||||||
|
csv.push(`${entityId},${safeState},${formatDate(s.last_changed)}\n`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
csv[0] = headers.join(",") + "\n";
|
csv[0] = headers.join(",") + "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user