Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
033b8e6b
Unverified
Commit
033b8e6b
authored
Mar 23, 2021
by
Max
Committed by
GitHub
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: S3 copyObject usage - Missing bucket name (#3745)
* Fix copyObject usage: supply bucket name * No semicolon * Assign empty string on initialization * Remove empty line
parent
9c3cb1aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
common.js
server/modules/storage/s3/common.js
+4
-2
No files found.
server/modules/storage/s3/common.js
View file @
033b8e6b
...
...
@@ -22,6 +22,7 @@ const getFilePath = (page, pathKey) => {
module
.
exports
=
class
S3CompatibleStorage
{
constructor
(
storageName
)
{
this
.
storageName
=
storageName
this
.
bucketName
=
""
}
async
activated
()
{
// not used
...
...
@@ -56,6 +57,7 @@ module.exports = class S3CompatibleStorage {
}
this
.
s3
=
new
S3
(
s3Config
)
this
.
bucketName
=
bucket
// determine if a bucket exists and you have permission to access it
await
this
.
s3
.
headBucket
().
promise
()
...
...
@@ -89,7 +91,7 @@ module.exports = class S3CompatibleStorage {
destinationFilePath
=
`
${
page
.
destinationLocaleCode
}
/
${
destinationFilePath
}
`
}
}
await
this
.
s3
.
copyObject
({
CopySource
:
sourceFilePath
,
Key
:
destinationFilePath
}).
promise
()
await
this
.
s3
.
copyObject
({
CopySource
:
`
${
this
.
bucketName
}
/
${
sourceFilePath
}
`
,
Key
:
destinationFilePath
}).
promise
()
await
this
.
s3
.
deleteObject
({
Key
:
sourceFilePath
}).
promise
()
}
/**
...
...
@@ -117,7 +119,7 @@ module.exports = class S3CompatibleStorage {
*/
async
assetRenamed
(
asset
)
{
WIKI
.
logger
.
info
(
`(STORAGE/
${
this
.
storageName
}
) Renaming file from
${
asset
.
path
}
to
${
asset
.
destinationPath
}
...`
)
await
this
.
s3
.
copyObject
({
CopySource
:
asset
.
path
,
Key
:
asset
.
destinationPath
}).
promise
()
await
this
.
s3
.
copyObject
({
CopySource
:
`
${
this
.
bucketName
}
/
${
asset
.
path
}
`
,
Key
:
asset
.
destinationPath
}).
promise
()
await
this
.
s3
.
deleteObject
({
Key
:
asset
.
path
}).
promise
()
}
async
getLocalLocation
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment