{"record":{"id":"9671de4efadfee2b","repo":"outline/outline","slug":"must-be-a-fully-qualified-domain-name","errorCode":null,"errorMessage":"Must be a fully qualified domain name","messagePattern":"Must be a fully qualified domain name","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/models/validators/IsFQDN.ts","lineNumber":12,"sourceCode":"import { isFQDN } from \"class-validator\";\nimport { addAttributeOptions } from \"sequelize-typescript\";\n\n/**\n * A decorator that validates that a string is a fully qualified domain name.\n */\nexport default function IsFQDN(target: object, propertyName: string) {\n  return addAttributeOptions(target, propertyName, {\n    validate: {\n      validDomain(value: string) {\n        if (!isFQDN(value)) {\n          throw new Error(\"Must be a fully qualified domain name\");\n        }\n      },\n    },\n  });\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/outline/outline/blob/935a44d4c003429645a956141b2c4eb695f34b6e/server/models/validators/IsFQDN.ts#L1-L18","documentation":"The IsFQDN decorator uses class-validator's isFQDN to ensure a model column holds a fully qualified domain name (e.g. sub.example.com). If the value fails FQDN rules (no dot, invalid chars, leading hyphen, etc.) the validator throws at save time.","triggerScenarios":"Saving a model column decorated with @IsFQDN (commonly allowed domains / custom hostnames) with a non-domain string like 'localhost', 'my domain', 'a_b', or an IP address.","commonSituations":"Configuring a custom domain/subdomain feature with an invalid hostname; user-supplied domain input not sanitized; entering a bare TLD or single label.","solutions":["Provide a valid FQDN with at least one dot and a TLD (e.g. docs.example.com).","Validate the domain client-side with a regex or the same isFQDN before submitting.","Strip protocol/path (https://) from the input so only the host remains."],"exampleFix":"// before\ndomain.host = 'https://docs.example.com/';\n\n// after\ndomain.host = 'docs.example.com';","handlingStrategy":"validation","validationCode":"import { isFQDN } from 'class-validator';\nif (!isFQDN(host)) {\n  throw new ValidationError('Must be a fully qualified domain name');\n}","typeGuard":"import { isFQDN } from 'class-validator';\nconst isFqdn = (v: string): v is string => isFQDN(v);","tryCatchPattern":null,"preventionTips":["Strip protocol and path before storing a host.","Validate with isFQDN on the client.","Reject single-label hostnames and IP literals unless explicitly allowed."],"tags":["server","models","validator","domain","validation"],"backgroundTag":null,"analyzedSha":"935a44d4c003429645a956141b2c4eb695f34b6e","analyzedAt":"2026-08-12T22:40:11.882Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}