@social-mail/social-mail-web-server 1.4.728 → 1.4.730

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.4.728",
3
+ "version": "1.4.730",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -390,8 +390,8 @@ export default class SnapshotService {
390
390
  // get file content...
391
391
  const url = new URL(link, "https://a");
392
392
  const tokens = url.pathname.substring(1).split("/");
393
- const fileID = tokens[5];
394
- const fileContent = await this.downloadFileContent(fileID, link);
393
+ const fileContentID = tokens[5];
394
+ const fileContent = await this.downloadSnapshotContent(fileContentID, link);
395
395
  e.parentElement.replaceChildren(...fileContent);
396
396
  updated = true;
397
397
  }
@@ -451,11 +451,15 @@ export default class SnapshotService {
451
451
  }
452
452
 
453
453
  @cacheFor()
454
- async downloadFileContent(fileID, link) {
455
- const file = await this.db.appFiles.where({ fileID }, (p) => (x) => x.appFileID === p.fileID)
454
+ async downloadSnapshotContent(fileContentID, link) {
455
+ const path = `${this.snapshotRoot.appFileID}/%`;
456
+ const file = await this.db.appFiles.where({ path, fileContentID }, (p) => (x) => Sql.text.like(x.path, p.path)
457
+ && x.fileContentID === p.fileContentID
458
+ )
459
+ .include((x) => x.fileContent)
456
460
  .first();
457
- if (!file) {
458
- console.error(`File ${fileID} not found for ${link}`);
461
+ if (!file?.fileContent) {
462
+ console.error(`File ${fileContentID} not found for ${link}`);
459
463
  }
460
464
  const localFile = await this.tempFileService.downloadAppFile(file);
461
465
  const text = await localFile.readAsText();