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:
Rotimi Best
2026-06-16 22:57:54 +01:00
parent 05a684caa5
commit 58aea2ab15
@@ -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 {};
};