mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 13:55:19 +00:00
Merge pull request #18564 from iPagar/empty-names
fix: validate folder and channel names before creation
This commit is contained in:
commit
82c45b721e
3 changed files with 10 additions and 1 deletions
|
|
@ -129,7 +129,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const createFolder = async ({ name, data }) => {
|
const createFolder = async ({ name, data }) => {
|
||||||
if (name === '') {
|
name = name?.trim();
|
||||||
|
if (!name) {
|
||||||
toast.error($i18n.t('Folder name cannot be empty.'));
|
toast.error($i18n.t('Folder name cannot be empty.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -479,6 +480,12 @@
|
||||||
<ChannelModal
|
<ChannelModal
|
||||||
bind:show={showCreateChannel}
|
bind:show={showCreateChannel}
|
||||||
onSubmit={async ({ name, access_control }) => {
|
onSubmit={async ({ name, access_control }) => {
|
||||||
|
name = name?.trim();
|
||||||
|
if (!name) {
|
||||||
|
toast.error($i18n.t('Channel name cannot be empty.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const res = await createNewChannel(localStorage.token, {
|
const res = await createNewChannel(localStorage.token, {
|
||||||
name: name,
|
name: name,
|
||||||
access_control: access_control
|
access_control: access_control
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,7 @@
|
||||||
"Channel": "",
|
"Channel": "",
|
||||||
"Channel deleted successfully": "",
|
"Channel deleted successfully": "",
|
||||||
"Channel Name": "",
|
"Channel Name": "",
|
||||||
|
"Channel name cannot be empty.": "",
|
||||||
"Channel updated successfully": "",
|
"Channel updated successfully": "",
|
||||||
"Channels": "",
|
"Channels": "",
|
||||||
"Character": "",
|
"Character": "",
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,7 @@
|
||||||
"Channel": "Канал",
|
"Channel": "Канал",
|
||||||
"Channel deleted successfully": "Канал успешно удалён",
|
"Channel deleted successfully": "Канал успешно удалён",
|
||||||
"Channel Name": "Название канала",
|
"Channel Name": "Название канала",
|
||||||
|
"Channel name cannot be empty.": "Название канала не может быть пустым.",
|
||||||
"Channel updated successfully": "Канал успешно обновлён",
|
"Channel updated successfully": "Канал успешно обновлён",
|
||||||
"Channels": "Каналы",
|
"Channels": "Каналы",
|
||||||
"Character": "Символ",
|
"Character": "Символ",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue