mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Escape special characters of automation ID in URL (#19790)
* Escape special character of automation ID in URL * Use encodeURIComponent
This commit is contained in:
parent
b982884933
commit
94f74308d8
@ -568,7 +568,7 @@ class HaConfigAreaPage extends LitElement {
|
|||||||
<a
|
<a
|
||||||
href=${ifDefined(
|
href=${ifDefined(
|
||||||
entityState.attributes.id
|
entityState.attributes.id
|
||||||
? `/config/automation/edit/${entityState.attributes.id}`
|
? `/config/automation/edit/${encodeURIComponent(entityState.attributes.id)}`
|
||||||
: undefined
|
: undefined
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
@ -172,7 +172,11 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
</ha-list-item>
|
</ha-list-item>
|
||||||
|
|
||||||
${stateObj && this._config && this.narrow
|
${stateObj && this._config && this.narrow
|
||||||
? html`<a href="/config/automation/trace/${this._config.id}">
|
? html`<a
|
||||||
|
href="/config/automation/trace/${encodeURIComponent(
|
||||||
|
this._config.id!
|
||||||
|
)}"
|
||||||
|
>
|
||||||
<ha-list-item graphic="icon">
|
<ha-list-item graphic="icon">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.show_trace"
|
"ui.panel.config.automation.editor.show_trace"
|
||||||
@ -563,7 +567,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
if (this._config?.id) {
|
if (this._config?.id) {
|
||||||
const result = await this.confirmUnsavedChanged();
|
const result = await this.confirmUnsavedChanged();
|
||||||
if (result) {
|
if (result) {
|
||||||
navigate(`/config/automation/trace/${this._config.id}`);
|
navigate(
|
||||||
|
`/config/automation/trace/${encodeURIComponent(this._config.id)}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,9 @@ class HaAutomationPicker extends LitElement {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
navigate(`/config/automation/trace/${automation.attributes.id}`);
|
navigate(
|
||||||
|
`/config/automation/trace/${encodeURIComponent(automation.attributes.id)}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _toggle(automation): Promise<void> {
|
private async _toggle(automation): Promise<void> {
|
||||||
@ -530,9 +532,11 @@ class HaAutomationPicker extends LitElement {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (automation?.attributes.id) {
|
if (automation?.attributes.id) {
|
||||||
navigate(`/config/automation/edit/${automation.attributes.id}`);
|
navigate(
|
||||||
|
`/config/automation/edit/${encodeURIComponent(automation.attributes.id)}`
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
navigate(`/config/automation/show/${ev.detail.id}`);
|
navigate(`/config/automation/show/${encodeURIComponent(ev.detail.id)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,9 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<a
|
<a
|
||||||
class="trace-link"
|
class="trace-link"
|
||||||
href="/config/automation/edit/${stateObj.attributes.id}"
|
href="/config/automation/edit/${encodeURIComponent(
|
||||||
|
stateObj.attributes.id
|
||||||
|
)}"
|
||||||
slot="toolbar-icon"
|
slot="toolbar-icon"
|
||||||
>
|
>
|
||||||
<mwc-button>
|
<mwc-button>
|
||||||
@ -140,7 +142,9 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<a
|
<a
|
||||||
class="trace-link"
|
class="trace-link"
|
||||||
href="/config/automation/edit/${stateObj.attributes.id}"
|
href="/config/automation/edit/${encodeURIComponent(
|
||||||
|
stateObj.attributes.id
|
||||||
|
)}"
|
||||||
>
|
>
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
|
@ -431,7 +431,7 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
<a
|
<a
|
||||||
href=${ifDefined(
|
href=${ifDefined(
|
||||||
entityState.attributes.id
|
entityState.attributes.id
|
||||||
? `/config/automation/edit/${entityState.attributes.id}`
|
? `/config/automation/edit/${encodeURIComponent(entityState.attributes.id)}`
|
||||||
: undefined
|
: undefined
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user