Return 404 when Tenant's logo is not found
MODIFY
src/server/rest/v1/service/TenantService.ts
src/server/rest/v1/service/TenantService.ts
@@ -93,10 +93,11 @@ export default class TenantService {
tenantLogo = await TenantStorage.getTenantLogo(tenant);
}
}
- let logo = tenantLogo && !Utils.isNullOrEmptyString(tenantLogo.logo) ? tenantLogo.logo : Constants.NO_IMAGE;
+ let logo = tenantLogo?.logo;
+ if (logo) {
+ // Header
let header = 'image';
let encoding: BufferEncoding = 'base64';
- // Remove encoding header
if (logo.startsWith('data:image/')) {
header = logo.substring(5, logo.indexOf(';'));
encoding = logo.substring(logo.indexOf(';') + 1, logo.indexOf(',')) as BufferEncoding;
@@ -104,6 +105,9 @@ export default class TenantService {
}
res.setHeader('content-type', header);
res.send(Buffer.from(logo, encoding));
+ } else {
+ res.status(StatusCodes.NOT_FOUND);
+ }
next();
}

Return 404 when Tenant's logo is not found