mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-24 21:48:12 +00:00
[FIX]: Fix Chinese characters causing empty workspace slug (#660)
if slug is empty on create workspace, generate a uuid as the workspace slug
This commit is contained in:
parent
d927629c19
commit
9d410496c0
1 changed files with 2 additions and 0 deletions
|
@ -3,6 +3,7 @@ const slugify = require("slugify");
|
|||
const { Document } = require("./documents");
|
||||
const { WorkspaceUser } = require("./workspaceUsers");
|
||||
const { ROLES } = require("../utils/middleware/multiUserProtected");
|
||||
const { v4: uuidv4 } = require("uuid");
|
||||
|
||||
const Workspace = {
|
||||
writable: [
|
||||
|
@ -22,6 +23,7 @@ const Workspace = {
|
|||
new: async function (name = null, creatorId = null) {
|
||||
if (!name) return { result: null, message: "name cannot be null" };
|
||||
var slug = slugify(name, { lower: true });
|
||||
slug = slug || uuidv4();
|
||||
|
||||
const existingBySlug = await this.get({ slug });
|
||||
if (existingBySlug !== null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue