fix: Allow subdomains upto 255 in self-hosted, closes #4524
This commit is contained in:
@@ -24,6 +24,7 @@ import { CollectionPermission, TeamPreference } from "@shared/types";
|
||||
import { getBaseDomain, RESERVED_SUBDOMAINS } from "@shared/utils/domains";
|
||||
import env from "@server/env";
|
||||
import DeleteAttachmentTask from "@server/queues/tasks/DeleteAttachmentTask";
|
||||
import isCloudHosted from "@server/utils/isCloudHosted";
|
||||
import parseAttachmentIds from "@server/utils/parseAttachmentIds";
|
||||
import Attachment from "./Attachment";
|
||||
import AuthenticationProvider from "./AuthenticationProvider";
|
||||
@@ -66,8 +67,10 @@ class Team extends ParanoidModel {
|
||||
@Unique
|
||||
@Length({
|
||||
min: 2,
|
||||
max: 32,
|
||||
msg: "subdomain must be between 2 and 32 characters",
|
||||
max: isCloudHosted ? 32 : 255,
|
||||
msg: `subdomain must be between 2 and ${
|
||||
isCloudHosted ? 32 : 255
|
||||
} characters`,
|
||||
})
|
||||
@Is({
|
||||
args: [/^[a-z\d-]+$/, "i"],
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
BeforeCreate,
|
||||
} from "sequelize-typescript";
|
||||
import { TeamValidation } from "@shared/validations";
|
||||
import env from "@server/env";
|
||||
import { ValidationError } from "@server/errors";
|
||||
import isCloudHosted from "@server/utils/isCloudHosted";
|
||||
import Team from "./Team";
|
||||
import User from "./User";
|
||||
import IdModel from "./base/IdModel";
|
||||
@@ -19,8 +19,6 @@ import Fix from "./decorators/Fix";
|
||||
import IsFQDN from "./validators/IsFQDN";
|
||||
import Length from "./validators/Length";
|
||||
|
||||
const isCloudHosted = env.DEPLOYMENT === "hosted";
|
||||
|
||||
@Table({ tableName: "team_domains", modelName: "team_domain" })
|
||||
@Fix
|
||||
class TeamDomain extends IdModel {
|
||||
|
||||
Reference in New Issue
Block a user