domains: validate well known
This commit is contained in:
+2
-2
@@ -47,13 +47,13 @@ async function get(domain, location) {
|
||||
if (!domainObject) throw new BoxError(BoxError.NOT_FOUND, 'Domain not found');
|
||||
if (!domainObject.wellKnown || !domainObject.wellKnown.carddav) throw new BoxError(BoxError.NOT_FOUND, 'No custom well-known config');
|
||||
|
||||
return { redirectTo: domainObject.wellKnown.carddav };
|
||||
return { redirectTo: `https://${domainObject.wellKnown.carddav}` };
|
||||
} else if (location === 'caldav') {
|
||||
const domainObject = await domains.get(domain);
|
||||
if (!domainObject) throw new BoxError(BoxError.NOT_FOUND, 'Domain not found');
|
||||
if (!domainObject.wellKnown || !domainObject.wellKnown.caldav) throw new BoxError(BoxError.NOT_FOUND, 'No custom well-known config');
|
||||
|
||||
return { redirectTo: domainObject.wellKnown.caldav };
|
||||
return { redirectTo: `https://${domainObject.wellKnown.caldav}` };
|
||||
} else {
|
||||
throw new BoxError(BoxError.NOT_FOUND, 'No custom well-known config');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user