Skip to content

File with prefix _ underscore synced with underscore character removed #27

@trietphm

Description

@trietphm

Hello,
I have a file called _INBOX/log.md. When it's synced from the remote source, instead of updating the existing file, it created a new one at INBOX/log.md

Here is the log

6/3/2025, 9:43:35 PM    32      [livesync] Watch starting from now
6/3/2025, 9:43:40 PM    16      WATCH: PROCESSING: _INBOX/log.md
6/3/2025, 9:43:41 PM    32      [livesync] --> _INBOX/log.md change detected
6/3/2025, 9:43:41 PM    32      [livesync] Original before to GlobalPath: _INBOX/log.md
6/3/2025, 9:43:41 PM    32      [notes] INBOX/log.md
6/3/2025, 9:43:41 PM    32      [notes] <-- notes/INBOX/log.md saved
6/3/2025, 9:43:41 PM    32      WATCH: PROCESS DONE: _INBOX/log.md
  • livesync is the couchbase and notes is the local storage.
  • I'm using Linux with the option "useChokidar": true. No path obfuscation.

After a quick check, I found out this line subtracted the first character when it saw a pathSrc that started with _

livesync-bridge/Peer.ts

Lines 27 to 34 in 3ff11c9

toGlobalPath(pathSrc: string) {
let path = pathSrc.startsWith("_") ? pathSrc.substring(1) : pathSrc;
if (path.startsWith(this.config.baseDir)) {
path = path.substring(this.config.baseDir.length);
}
// this.debugLog(`**TOLOCAL: ${pathSrc} => ${path}`);
return path;
}

This line6/3/2025, 9:43:41 PM 32 [livesync] Original before to GlobalPath: _INBOX/log.md is what I'm debugging to confirm.

I can help kind of "fix" it, but I don't know what the toGlobalPath is supposed to be used for, nor why there is that substring logic above.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions