fix: Code style & add type.

This commit is contained in:
Shibo Lyu 2023-12-17 21:57:33 +08:00 committed by Shibo Lyu
parent 1bc60e8f40
commit ac6e5bc277

View file

@ -68,7 +68,7 @@ class S3Storage extends StorageBase {
Boolean(forcePathStyle) || Boolean(forcePathStyle) ||
false false
let defaultHost; let defaultHost: string
if (this.forcePathStyle) { if (this.forcePathStyle) {
defaultHost = `https://s3${ defaultHost = `https://s3${
@ -82,7 +82,8 @@ class S3Storage extends StorageBase {
this.host = this.host =
process.env.GHOST_STORAGE_ADAPTER_S3_ASSET_HOST || process.env.GHOST_STORAGE_ADAPTER_S3_ASSET_HOST ||
assetHost || defaultHost assetHost ||
defaultHost
this.pathPrefix = stripLeadingSlash( this.pathPrefix = stripLeadingSlash(
process.env.GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX || pathPrefix || '' process.env.GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX || pathPrefix || ''
@ -152,7 +153,7 @@ class S3Storage extends StorageBase {
async save(image: Image, targetDir?: string) { async save(image: Image, targetDir?: string) {
const directory = targetDir || this.getTargetDir(this.pathPrefix) const directory = targetDir || this.getTargetDir(this.pathPrefix)
const fileName = await this.getUniqueFileName(image, directory); const fileName = await this.getUniqueFileName(image, directory)
const file = createReadStream(image.path) const file = createReadStream(image.path)
let config: PutObjectCommandInput = { let config: PutObjectCommandInput = {