Skip to content

Fix decoding of url-encoded relative paths - #86

Merged
c3er merged 3 commits into
c3er:masterfrom
Anas-Shakeel:fix/issue-85
Jul 30, 2026
Merged

Fix decoding of url-encoded relative paths#86
c3er merged 3 commits into
c3er:masterfrom
Anas-Shakeel:fix/issue-85

Conversation

@Anas-Shakeel

Copy link
Copy Markdown
Contributor

Summary

This PR fixes navigation to local resources whose relative paths contain url-encoded characters (e.g. chinese filenames/directories).

Previously, relative paths were resolved without being decoded first, causing links such as ../证据/note.md to fail after being url-encoded.

Changes

  • Decode url-encoded relative paths before resolving them to local filesystem paths.
  • Display decoded URLs in the status bar for improved readability.
  • Preserve existing behavior for external URLs (HTTP(S), mailto:, etc.).

Tests

Added tests covering:

  • url-encoded Unicode directory names.
  • url-encoded spaces.
  • Malformed encoded paths (left unchanged).
  • ASCII-only relative paths (unchanged).

This fixes the reported issue with navigating to Markdown files whose paths contain non-ASCII characters while preserving existing behavior for web links.

Fixes #85

@c3er c3er left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

I can confirm that it works as expected. Only the error handling could be a little improved. See my other comments

Comment thread app/lib/file.js Outdated
Comment thread app/index.js Outdated
@Anas-Shakeel

Copy link
Copy Markdown
Contributor Author

I just realized that you asked to log the entire err object and not just err.message!

@c3er
c3er merged commit 7aa932a into c3er:master Jul 30, 2026
2 checks passed
@c3er

c3er commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution again!👍

I just realized that you asked to log the entire err object and not just err.message!

Yes, it's better to just show all the available information.

@Anas-Shakeel
Anas-Shakeel deleted the fix/issue-85 branch July 31, 2026 01:23
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.

Relative .md links with Chinese (non-ASCII) paths fail: percent-encoded path treated as literal file

2 participants