@social-mail/social-mail-web-server 1.4.729 → 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.729",
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,12 +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
+ )
456
459
  .include((x) => x.fileContent)
457
460
  .first();
458
461
  if (!file?.fileContent) {
459
- console.error(`File ${fileID} not found for ${link}`);
462
+ console.error(`File ${fileContentID} not found for ${link}`);
460
463
  }
461
464
  const localFile = await this.tempFileService.downloadAppFile(file);
462
465
  const text = await localFile.readAsText();