Skip to content

Commit 434bc55

Browse files
committed
fix(attachment): Fix attachment sync issue.
1 parent b41b6dd commit 434bc55

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/remote.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
import * as s3 from "./remoteForS3";
88
import { Path, WEB_PATH_SPLITER } from './utils/path';
99
import { log } from "./moreOnLog";
10-
import { RemoteSrcPrefix } from "./sync";
10+
import { RemoteSrcPrefix, RemoteAttPrefix } from "./sync";
1111

1212
export { ServerDomain, HostServerUrl, AppHostServerUrl } from './remoteForS3'
1313
export class RemoteClient {
@@ -78,7 +78,7 @@ export class RemoteClient {
7878
if (!this.useHost) {
7979
localPath = key;
8080
} else {
81-
const hasPrefix = key?.startsWith(RemoteSrcPrefix);
81+
const hasPrefix = key?.startsWith(RemoteSrcPrefix) || key?.startsWith(RemoteAttPrefix);
8282
const paths = Path.splitString(key);
8383
if (paths?.length > 0) {
8484
let dir = hasPrefix ? paths[1] : paths[0];
@@ -93,7 +93,6 @@ export class RemoteClient {
9393
localPath = Path.joinString(paths);
9494
}
9595
}
96-
9796
return localPath;
9897
}
9998

src/sync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ export const syncAttachment = async (vault: Vault, client: RemoteClient, embeds:
17951795
null,
17961796
false,
17971797
null,
1798-
`${RemoteAttPrefix}/${link}`
1798+
`${RemoteAttPrefix}${client.localWatchDir}/${link}`
17991799
)
18001800
.then(resp => {
18011801
cb && cb('upload', link, resp);
@@ -1819,7 +1819,7 @@ export const syncAttachment = async (vault: Vault, client: RemoteClient, embeds:
18191819
await Promise.all(diff.map(async link => {
18201820
log.info('downloading attachment: ', link);
18211821
return client.downloadFromRemote(
1822-
link,
1822+
`${client.localWatchDir}/${link}`,
18231823
RemoteAttPrefix,
18241824
vault,
18251825
Date.now(),

0 commit comments

Comments
 (0)