diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-07-24 05:04:43 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-07-24 05:04:43 +0900 |
| commit | adc3c16ef3bd53a4f1bb84ab7ca0fcc64384fe8f (patch) | |
| tree | 3c64bddfeff2230f445907037b63bcc5a26b2b94 /src/services | |
| parent | wip (diff) | |
| download | sharkey-adc3c16ef3bd53a4f1bb84ab7ca0fcc64384fe8f.tar.gz sharkey-adc3c16ef3bd53a4f1bb84ab7ca0fcc64384fe8f.tar.bz2 sharkey-adc3c16ef3bd53a4f1bb84ab7ca0fcc64384fe8f.zip | |
wip
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/drive/add-file.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index a1b9686956..4f379a25be 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -35,6 +35,8 @@ async function save(readable: stream.Readable, name: string, type: string, hash: await minio.putObject(config.drive.bucket, obj, readable); Object.assign(metadata, { + storage: 'object-storage', + withoutChunks: true, obj: id, url: `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }/${ obj }` }); @@ -97,7 +99,7 @@ export default async function( comment: string = null, folderId: mongodb.ObjectID = null, force: boolean = false, - metaOnly: boolean = false, + isLink: boolean = false, url: string = null, uri: string = null, sensitive = false @@ -165,7 +167,7 @@ export default async function( } //#region Check drive usage - if (!metaOnly) { + if (!isLink) { const usage = await DriveFile .aggregate([{ $match: { @@ -277,19 +279,23 @@ export default async function( folderId: folder !== null ? folder._id : null, comment: comment, properties: properties, - isMetaOnly: metaOnly, + withoutChunks: isLink, isSensitive: sensitive } as IMetadata; if (url !== null) { - metadata.url = url; + metadata.src = url; + + if (isLink) { + metadata.url = url; + } } if (uri !== null) { metadata.uri = uri; } - const driveFile = metaOnly + const driveFile = isLink ? await DriveFile.insert({ length: 0, uploadDate: new Date(), |