Skip to content

Fix sync status and diff handling for branch/subfolder text files - #24

Closed
lukelzlz wants to merge 2 commits into
rhoades-brown:mainfrom
lukelzlz:codex/fix-sync-diff-encoding
Closed

Fix sync status and diff handling for branch/subfolder text files#24
lukelzlz wants to merge 2 commits into
rhoades-brown:mainfrom
lukelzlz:codex/fix-sync-diff-encoding

Conversation

@lukelzlz

@lukelzlz lukelzlz commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What changed

  • preserve the configured branch when fetching remote file contents during sync
  • mark sync results as failed when pull operations return file errors
  • resolve diff-view remote paths inside configured repository subfolders
  • auto-detect common East Asian text encodings when decoding remote GitHub file contents

Why

Sync and diff behavior could be misleading in a few important cases:

  • branch-specific files could be fetched from the default branch instead of the configured branch
  • sync logs could report completion even when remote pulls failed
  • diff view could request the wrong remote path when the vault mapped into a repo subfolder
  • non-UTF-8 remote notes could render as mojibake in diff view

Impact

  • sync status is now more accurate
  • diff view shows the correct remote file in subfolder-based setups
  • remote text previews handle more real-world note encodings

Validation

  • npm test
  • npm run build

@lukelzlz lukelzlz changed the title [codex] Fix sync status and diff handling for branch/subfolder text files Fix sync status and diff handling for branch/subfolder text files Jul 6, 2026
@lukelzlz
lukelzlz marked this pull request as ready for review July 6, 2026 13:26
@rhoades-brown

Copy link
Copy Markdown
Owner

Hi. @lukelzlz - sorry it has taken me so long to review this, I had not seen the GitHub notifications. I am taking a look right now...

@rhoades-brown

rhoades-brown commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Firstly, thanks again @lukelzlz for the PR, I really appreciate it and some of these bugs are something I came here to work on.

I have cherry-picked the, pull-failure, subfolder-path, and UTF-8 decodeBase64 (instead of atob) fixes have into #25 so they can be applied now.

This PR can keep the GB18030/Big5/Shift-JIS autodetection so we can discuss that separately.

From what I understand, Obsidian only supports UTF-8 - Encoding Auto-Fix is a useful plugin designed to support other formats, but it is not a straight GB18030 loop:

  • it converts local files to UTF-8 with BOM/confidence checks
  • it does not list GB18030, Big5, or Shift-JIS
  • it refuses low-confidence guesses instead of taking the first decoder that does not throw

I understand what you are trying to do, but I wonder if this aspect needs some improvement?

@rhoades-brown
rhoades-brown force-pushed the codex/fix-sync-diff-encoding branch from b2de1ef to d55e22b Compare August 29, 2026 11:35
@rhoades-brown
rhoades-brown force-pushed the codex/fix-sync-diff-encoding branch from d55e22b to f58d2b7 Compare August 29, 2026 12:32
@lukelzlz

Copy link
Copy Markdown
Contributor Author

Hi @rhoades-brown,

That makes total sense. Keeping it strictly UTF-8 avoids false-positive decoding and stays aligned with Obsidian's core expectations, so let's skip the multi-encoding try-catch fallback.

I saw that #25 has already been merged—thanks for quickly reviewing and integrating the fixes!

I'll go ahead and close this PR now. Thanks again for maintaining the project!

@lukelzlz lukelzlz closed this Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants