mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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
|
||||
href=${ifDefined(
|
||||
entityState.attributes.id
|
||||
? `/config/automation/edit/${entityState.attributes.id}`
|
||||
? `/config/automation/edit/${encodeURIComponent(entityState.attributes.id)}`
|
||||
: undefined
|
||||
)}
|
||||
>
|
||||
|
@ -172,7 +172,11 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
</ha-list-item>
|
||||
|
||||
${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">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.automation.editor.show_trace"
|
||||
@ -563,7 +567,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
if (this._config?.id) {
|
||||
const result = await this.confirmUnsavedChanged();
|
||||
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;
|
||||
}
|
||||
navigate(`/config/automation/trace/${automation.attributes.id}`);
|
||||
navigate(
|
||||
`/config/automation/trace/${encodeURIComponent(automation.attributes.id)}`
|
||||
);
|
||||
}
|
||||
|
||||
private async _toggle(automation): Promise<void> {
|
||||
@ -530,9 +532,11 @@ class HaAutomationPicker extends LitElement {
|
||||
);
|
||||
|
||||
if (automation?.attributes.id) {
|
||||
navigate(`/config/automation/edit/${automation.attributes.id}`);
|
||||
navigate(
|
||||
`/config/automation/edit/${encodeURIComponent(automation.attributes.id)}`
|
||||
);
|
||||
} 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`
|
||||
<a
|
||||
class="trace-link"
|
||||
href="/config/automation/edit/${stateObj.attributes.id}"
|
||||
href="/config/automation/edit/${encodeURIComponent(
|
||||
stateObj.attributes.id
|
||||
)}"
|
||||
slot="toolbar-icon"
|
||||
>
|
||||
<mwc-button>
|
||||
@ -140,7 +142,9 @@ export class HaAutomationTrace extends LitElement {
|
||||
? html`
|
||||
<a
|
||||
class="trace-link"
|
||||
href="/config/automation/edit/${stateObj.attributes.id}"
|
||||
href="/config/automation/edit/${encodeURIComponent(
|
||||
stateObj.attributes.id
|
||||
)}"
|
||||
>
|
||||
<mwc-list-item graphic="icon">
|
||||
${this.hass.localize(
|
||||
|
@ -431,7 +431,7 @@ export class HaConfigDevicePage extends LitElement {
|
||||
<a
|
||||
href=${ifDefined(
|
||||
entityState.attributes.id
|
||||
? `/config/automation/edit/${entityState.attributes.id}`
|
||||
? `/config/automation/edit/${encodeURIComponent(entityState.attributes.id)}`
|
||||
: undefined
|
||||
)}
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user