FileHtmlArtifactStore.forTenant constructor
Creates an isolated local store below root for one trusted tenant ID.
Use the same tenant ID that was resolved from an authenticated host, never an arbitrary webhook or query parameter value.
Implementation
factory FileHtmlArtifactStore.forTenant(Directory root, String tenantId) {
if (!RegExp(r'^[A-Za-z0-9_-]{1,120}$').hasMatch(tenantId)) {
throw const FormatException('Invalid artifact tenant ID.');
}
return FileHtmlArtifactStore(
Directory(
'${root.absolute.path}${Platform.pathSeparator}tenants${Platform.pathSeparator}$tenantId',
),
);
}