Ensure we lowercase the domain name before consuming it in dns setup

Finally fixes #335
This commit is contained in:
Johannes Zellner
2017-06-01 17:29:36 +02:00
parent 7f30b8de9d
commit 9c8a8571b4

View File

@@ -80,7 +80,7 @@ function dnsSetup(req, res, next) {
if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required'));
if (typeof req.body.domain !== 'string' || !req.body.domain) return next(new HttpError(400, 'domain is required'));
cloudron.dnsSetup(req.body, req.body.domain, function (error) {
cloudron.dnsSetup(req.body, req.body.domain.toLowerCase(), function (error) {
if (error && error.reason === CloudronError.ALREADY_SETUP) return next(new HttpError(409, error.message));
if (error && error.reason === CloudronError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error) return next(new HttpError(500, error));