eip-cloud-services 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/s3.js +3 -3
package/package.json
CHANGED
package/src/s3.js
CHANGED
|
@@ -105,14 +105,14 @@ exports.get = async ( key, bucket = config.s3.Bucket ) => {
|
|
|
105
105
|
data = zlib.unzipSync ( data );
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
if ( response.ContentType !== 'application/json' ) {
|
|
108
|
+
if ( response.ContentType !== 'application/json' && !response.Metadata[ 'tmg-json' ] ) {
|
|
109
109
|
if ( config.s3.logs === 'output' )
|
|
110
110
|
log ( `S3 [GET]: Returned ${response.ContentType} from ${bucket}/${key}.` );
|
|
111
111
|
|
|
112
112
|
return data.toString ( 'utf8' );
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
if ( response.ContentType === 'application/json' && response.Metadata[ 'tmg-crypt' ] && response.Metadata[ 'tmg-crypt-vec' ] ) {
|
|
115
|
+
if ( ( response.ContentType === 'application/json' || response.Metadata[ 'tmg-json' ] ) && response.Metadata[ 'tmg-crypt' ] && response.Metadata[ 'tmg-crypt-vec' ] ) {
|
|
116
116
|
const key = await crypto.subtle.importKey (
|
|
117
117
|
'raw',
|
|
118
118
|
Buffer.from ( response.Metadata[ 'tmg-crypt' ], 'base64' ),
|
|
@@ -172,7 +172,7 @@ exports.set = async ( key, body, options = {} ) => {
|
|
|
172
172
|
metadata = {}
|
|
173
173
|
} = options;
|
|
174
174
|
|
|
175
|
-
if ( encrypt && contentType === 'application/json' ) {
|
|
175
|
+
if ( encrypt && ( contentType === 'application/json' || contentType === 'text/plain' ) ) {
|
|
176
176
|
|
|
177
177
|
if ( config.s3.logs === 'verbose' )
|
|
178
178
|
log ( `S3 [SET]: ${bucket}/${key} - Encrypting.` );
|