mirror of
https://github.com/laosb/ghos3.git
synced 2025-04-30 23:51: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
|
@ -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 = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue