pangea-server 3.3.66 → 3.3.68

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.
@@ -22,7 +22,12 @@ const s3 = new aws_sdk_1.default.S3({
22
22
  const expiresTime = 60;
23
23
  class FileStorage {
24
24
  static GenerateDownloadUrl(fileName) {
25
- return s3.getSignedUrlPromise('getObject', { Bucket: bucketName, Key: fileName, Expires: expiresTime });
25
+ return s3.getSignedUrlPromise('getObject', {
26
+ Bucket: bucketName,
27
+ Key: fileName,
28
+ Expires: expiresTime,
29
+ ResponseCacheControl: 'no-store, no-cache, max-age=0',
30
+ });
26
31
  }
27
32
  static GenerateDownloadUrls(fileNames) {
28
33
  return Promise.all(fileNames.map((fileName) => this.GenerateDownloadUrl(fileName)));
@@ -70,7 +75,13 @@ exports.FileStorage = FileStorage;
70
75
  // internal functions
71
76
  function getGeneralUploadParams(config) {
72
77
  const fileName = `${config.folder}/${(0, random_helpers_1.getRandomString)('short')}`;
73
- return { Bucket: bucketName, Key: fileName, ContentType: config.fileType, ACL: 'private' };
78
+ return {
79
+ Bucket: bucketName,
80
+ Key: fileName,
81
+ ContentType: config.fileType,
82
+ ACL: 'private',
83
+ CacheControl: 'private, no-store, no-cache, max-age=0',
84
+ };
74
85
  }
75
86
  async function uploadFile(body, config) {
76
87
  const params = { ...getGeneralUploadParams(config), Body: body };
@@ -62,6 +62,7 @@ function hasInstancesAndTotalCount(obj) {
62
62
  }
63
63
  async function setImageUrls(data) {
64
64
  const targets = [];
65
+ const visited = new WeakSet();
65
66
  function collect(node) {
66
67
  if (!node)
67
68
  return;
@@ -71,6 +72,9 @@ async function setImageUrls(data) {
71
72
  }
72
73
  if (typeof node !== 'object')
73
74
  return;
75
+ if (visited.has(node))
76
+ return;
77
+ visited.add(node);
74
78
  if (typeof node.image === 'string' && node.image.length)
75
79
  targets.push(node);
76
80
  Object.values(node).forEach(collect);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.66",
4
+ "version": "3.3.68",
5
5
  "files": [
6
6
  "dist"
7
7
  ],