const dbAstro = _db.get('astro', _req.getString('uid'))
|
|
_log.info( dbAstro );
|
|
|
|
if (dbAstro) {
|
|
const dbAstroImageName = dbAstro.getString('image')
|
|
const storageAstroImageFile = _storage.database(
|
|
'astro',
|
|
'image',
|
|
dbAstroImageName
|
|
)
|
|
switch (storageAstroImageFile.extension()){
|
|
case 'jpg':
|
|
_header.contentTypeJPG()
|
|
break;
|
|
case 'png':
|
|
_header.contentTypePNG()
|
|
break;
|
|
default:
|
|
_error.fatal(`Invalid image extension ${storageAstroImageFile.extension()}`)
|
|
}
|
|
_header.noCache()
|
|
_out.copy(storageAstroImageFile.inputStream())
|
|
} else {
|
|
_header.status(404)
|
|
_out.json(
|
|
_val.map()
|
|
.set("error", "astro-image-not-found")
|
|
)
|
|
}
|