u
This commit is contained in:
@@ -966,16 +966,14 @@ const actions = {
|
||||
* @param {object[]} [maybeAttachments]
|
||||
*/
|
||||
async sendMessage(textOrPayload, maybeAttachments = []) {
|
||||
let trimmed = '';
|
||||
let fileAttachments = [];
|
||||
|
||||
if (typeof textOrPayload === 'object' && textOrPayload !== null) {
|
||||
trimmed = (textOrPayload.text || '').trim();
|
||||
fileAttachments = Array.isArray(textOrPayload.attachments) ? textOrPayload.attachments : [];
|
||||
} else {
|
||||
trimmed = (textOrPayload || '').trim();
|
||||
fileAttachments = Array.isArray(maybeAttachments) ? maybeAttachments : [];
|
||||
}
|
||||
const trimmed =
|
||||
typeof textOrPayload === 'object' && textOrPayload !== null
|
||||
? (textOrPayload.text || '').trim()
|
||||
: (textOrPayload || '').trim();
|
||||
const fileAttachments =
|
||||
typeof textOrPayload === 'object' && textOrPayload !== null
|
||||
? (Array.isArray(textOrPayload.attachments) ? textOrPayload.attachments : [])
|
||||
: (Array.isArray(maybeAttachments) ? maybeAttachments : []);
|
||||
|
||||
if (!trimmed && fileAttachments.length === 0) return;
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ const actions = {
|
||||
* @param {string} [initialContent='']
|
||||
*/
|
||||
async createFile(name, initialContent = '') {
|
||||
const clean = String(name || '').trim().replace(/^[\/\\]+/, '');
|
||||
const clean = String(name || '').trim().replace(/^[/\\]+/, '');
|
||||
if (!clean) throw new Error('Dateiname darf nicht leer sein');
|
||||
|
||||
vfsAutomat.setState({ isSaving: true, saveError: null, newFileDialogOpen: false });
|
||||
|
||||
Reference in New Issue
Block a user