forked from noxious/server
Many many more improvements
This commit is contained in:
@ -3,7 +3,6 @@ import fs from 'fs'
|
||||
import { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import { httpLogger } from '#application/logger'
|
||||
import { getPublicPath } from '#application/storage'
|
||||
import { AssetData, UUID } from '#application/types'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
@ -99,13 +98,13 @@ export class AssetsController extends BaseController {
|
||||
const assetPath = type === 'sprites' && spriteId ? getPublicPath(type, spriteId, file) : getPublicPath(type, file)
|
||||
|
||||
if (!fs.existsSync(assetPath)) {
|
||||
httpLogger.error(`File not found: ${assetPath}`)
|
||||
this.logger.error(`File not found: ${assetPath}`)
|
||||
return this.sendError(res, 'Asset not found', 404)
|
||||
}
|
||||
|
||||
res.sendFile(assetPath, (err) => {
|
||||
if (err) {
|
||||
httpLogger.error('Error sending file:', err)
|
||||
this.logger.error('Error sending file:' + err)
|
||||
this.sendError(res, 'Error downloading the asset', 500)
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user