mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: improves handling of filter with invalid tag chars (#17640)
Tags mixin is already filtering a lot of data from the user submitted filter in `createContentFromInput()` which can lead to sk receiving an empty filter while the input actually has a value.
This commit is contained in:
@@ -25,6 +25,10 @@ export default Mixin.create({
|
||||
allowAnyTag: reads("site.can_create_tag"),
|
||||
|
||||
validateCreate(filter, content) {
|
||||
if (!filter.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const maximum = this.selectKit.options.maximum;
|
||||
if (maximum && makeArray(this.value).length >= parseInt(maximum, 10)) {
|
||||
this.addError(
|
||||
@@ -42,18 +46,6 @@ export default Mixin.create({
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!filter.length ||
|
||||
this.get("siteSettings.max_tag_length") < filter.length
|
||||
) {
|
||||
this.addError(
|
||||
I18n.t("select_kit.invalid_selection_length", {
|
||||
count: `[1 - ${this.get("siteSettings.max_tag_length")}]`,
|
||||
})
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
const toLowerCaseOrUndefined = (string) => {
|
||||
return isEmpty(string) ? undefined : string.toLowerCase();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user