fix(org-site): 404 on subdomains that don't resolve to an org
A subdomain like xxazzz.myclassroomio.com set isOrgSite=true with a null org, and the course page fell back to resolving the org from the course itself — so courses rendered under subdomains that don't exist. Guard the (org-site) layout so an unresolved org site 404s instead.
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
|
export const load = async ({ parent }) => {
|
||||||
|
const { org, isOrgSite } = await parent();
|
||||||
|
|
||||||
|
// An org-site subdomain that doesn't resolve to a real org must 404 rather
|
||||||
|
// than fall back to whatever org a requested course happens to belong to.
|
||||||
|
if (isOrgSite && !org) {
|
||||||
|
throw error(404, 'Organization not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user