Przeglądaj źródła

fix: skip if default domain is used as custom domain. Resolves #287

poeti8 5 lat temu
rodzic
commit
e45321668b
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      server/handlers/validators.ts

+ 6 - 0
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