mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Fix % character in tag name causing UI crash (#2757)
* Fix % character in tag name causing UI crash
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
### 🐛 Bug fixes
|
### 🐛 Bug fixes
|
||||||
|
* Fix UI crash when % character used in tag names. ([#2757](https://github.com/stashapp/stash/pull/2757))
|
||||||
* Fix keyboard shortcuts not working after selecting an object. ([#2750](https://github.com/stashapp/stash/pull/2750))
|
* Fix keyboard shortcuts not working after selecting an object. ([#2750](https://github.com/stashapp/stash/pull/2750))
|
||||||
* Fix UI crash on session timeout. ([#2755](https://github.com/stashapp/stash/pull/2755))
|
* Fix UI crash on session timeout. ([#2755](https://github.com/stashapp/stash/pull/2755))
|
||||||
* Fix incorrect scene metadata being set when video has cover art. ([#2752](https://github.com/stashapp/stash/pull/2752))
|
* Fix incorrect scene metadata being set when video has cover art. ([#2752](https://github.com/stashapp/stash/pull/2752))
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import DurationUtils from "src/utils/duration";
|
|||||||
import {
|
import {
|
||||||
CriterionType,
|
CriterionType,
|
||||||
encodeILabeledId,
|
encodeILabeledId,
|
||||||
|
encodeLabel,
|
||||||
IHierarchicalLabelValue,
|
IHierarchicalLabelValue,
|
||||||
ILabeledId,
|
ILabeledId,
|
||||||
ILabeledValue,
|
ILabeledValue,
|
||||||
@@ -456,7 +457,7 @@ export class IHierarchicalLabeledIdCriterion extends Criterion<IHierarchicalLabe
|
|||||||
|
|
||||||
public getLabelValue(): string {
|
public getLabelValue(): string {
|
||||||
const labels = decodeURI(
|
const labels = decodeURI(
|
||||||
(this.value.items ?? []).map((v) => v.label).join(", ")
|
(this.value.items ?? []).map((v) => encodeLabel(v.label)).join(", ")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.value.depth === 0) {
|
if (this.value.depth === 0) {
|
||||||
|
|||||||
@@ -47,10 +47,14 @@ export function criterionIsNumberValue(
|
|||||||
return typeof value === "object" && "value" in value && "value2" in value;
|
return typeof value === "object" && "value" in value && "value2" in value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function encodeILabeledId(o: ILabeledId) {
|
export function encodeLabel(v: string) {
|
||||||
// escape " and \ and by encoding to JSON so that it encodes to JSON correctly down the line
|
// escape " and \ and by encoding to JSON so that it encodes to JSON correctly down the line
|
||||||
const adjustedLabel = JSON.stringify(o.label).slice(1, -1);
|
const adjustedLabel = JSON.stringify(v).slice(1, -1);
|
||||||
return { ...o, label: encodeURIComponent(adjustedLabel) };
|
return encodeURIComponent(adjustedLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeILabeledId(o: ILabeledId) {
|
||||||
|
return { ...o, label: encodeLabel(o.label) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOptionType {
|
export interface IOptionType {
|
||||||
|
|||||||
Reference in New Issue
Block a user