Skip to content

Decode Markdown filename URIs in preview (allow spaces)#964

Merged
mbostock merged 1 commit into
observablehq:mainfrom
huw:main
Mar 4, 2024
Merged

Decode Markdown filename URIs in preview (allow spaces)#964
mbostock merged 1 commit into
observablehq:mainfrom
huw:main

Conversation

@huw
Copy link
Copy Markdown
Contributor

@huw huw commented Mar 4, 2024

While running Framework with a Markdown file with spaces in its name (Test File.md), I encountered:

Protocol error Error: ENOENT: no such file or directory, open 'Test%20File.md'
    at open (node:internal/fs/promises:633:25)
    at readFile (node:internal/fs/promises:1242:14)
    at parseMarkdown (file:///Users/huw/Library/Mobile Documents/iCloud~md~obsidian/Documents/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@observablehq/framework/src/markdown.ts:421:18)
    at hello (file:///Users/huw/Library/Mobile Documents/iCloud~md~obsidian/Documents/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@observablehq/framework/src/preview.ts:373:15)
    at WebSocket.<anonymous> (file:///Users/huw/Library/Mobile Documents/iCloud~md~obsidian/Documents/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@observablehq/framework/src/preview.ts:386:11) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'Test%20File.md'
}
socket close /_observablehq

This prevented all live reloads. I investigated the cause and noticed that we weren't ever decoding the filename in the preview watcher. I fixed it and tested locally, and also ran yarn test. FWIW I got 596 passing tests, but a couple of data loader tests failed (I assume this is irrelevant).

Please let me know what else I need to do to contribute—and thank you for all your work, I love Observable ^_^

Copy link
Copy Markdown
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

Thanks!

@mbostock mbostock enabled auto-merge (squash) March 4, 2024 08:22
@mbostock mbostock merged commit f6b9ab5 into observablehq:main Mar 4, 2024
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