Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thedevs-network/kutt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorpoeti8 <ezzati.upt@gmail.com>2020-07-11 18:17:02 +0300
committerpoeti8 <ezzati.upt@gmail.com>2020-07-11 18:18:06 +0300
commite45321668b371b53ce092889f1869a0c163dfb1f (patch)
tree5c0b027a5a7de464f84b09447b912155053c9876 /server
parentcdf0a13f7722090dc4c10d232aa689b0b0cdd730 (diff)
fix: skip if default domain is used as custom domain. Resolves #287
Diffstat (limited to 'server')
-rw-r--r--server/handlers/validators.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/handlers/validators.ts b/server/handlers/validators.ts
index 105ec69..e76404a 100644
--- a/server/handlers/validators.ts
+++ b/server/handlers/validators.ts
@@ -88,7 +88,13 @@ export const createLink = [
.isString()
.withMessage("Domain should be string.")
.customSanitizer(value => value.toLowerCase())
+ .customSanitizer(value => URL.parse(value).hostname || value)
.custom(async (address, { req }) => {
+ if (address === env.DEFAULT_DOMAIN) {
+ req.body.domain = null;
+ return;
+ }
+
const domain = await query.domain.find({
address,
user_id: req.user.id