mirror of
https://github.com/laosb/ghos3.git
synced 2025-04-30 15:41:08 +00:00
fix: Code style & add type.
This commit is contained in:
parent
1bc60e8f40
commit
ac6e5bc277
1 changed files with 8 additions and 7 deletions
15
src/index.ts
15
src/index.ts
|
@ -67,10 +67,10 @@ class S3Storage extends StorageBase {
|
|||
Boolean(process.env.GHOST_STORAGE_ADAPTER_S3_FORCE_PATH_STYLE) ||
|
||||
Boolean(forcePathStyle) ||
|
||||
false
|
||||
|
||||
let defaultHost;
|
||||
|
||||
if(this.forcePathStyle) {
|
||||
|
||||
let defaultHost: string
|
||||
|
||||
if (this.forcePathStyle) {
|
||||
defaultHost = `https://s3${
|
||||
this.region === 'us-east-1' ? '' : `.${this.region}`
|
||||
}.amazonaws.com/${this.bucket}`
|
||||
|
@ -82,8 +82,9 @@ class S3Storage extends StorageBase {
|
|||
|
||||
this.host =
|
||||
process.env.GHOST_STORAGE_ADAPTER_S3_ASSET_HOST ||
|
||||
assetHost || defaultHost
|
||||
|
||||
assetHost ||
|
||||
defaultHost
|
||||
|
||||
this.pathPrefix = stripLeadingSlash(
|
||||
process.env.GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX || pathPrefix || ''
|
||||
)
|
||||
|
@ -152,7 +153,7 @@ class S3Storage extends StorageBase {
|
|||
async save(image: Image, targetDir?: string) {
|
||||
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)
|
||||
|
||||
let config: PutObjectCommandInput = {
|
||||
|
|
Loading…
Add table
Reference in a new issue