Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URI-encode in the middleware? #8

Open
Cerchie opened this issue Apr 28, 2023 · 1 comment
Open

URI-encode in the middleware? #8

Cerchie opened this issue Apr 28, 2023 · 1 comment

Comments

@Cerchie
Copy link
Contributor

Cerchie commented Apr 28, 2023

I'm wondering why URI-encoding is left to the user?

I experimented a little this morning. In line 12 of headers.js, I inserted: request.headers.markdown = encodeURIComponent(request.headers.markdown);

Then, when I ran curl --location 'http://localhost:3000/blog/example' --header 'markdown: # Hello World' (I'll acknowledge it was difficult to get the original example markdown on one line, maybe that's part of it) I received a response including:

...
			
	<div class="blog">
		<h1 id="hello-world">Hello World</h1>

	</div>

so it seemed to be working from the curl response, but it was not reflected in the browser:
Screen Shot 2023-04-28 at 6 10 45 AM

Curious about why this might be, but also, why the user must URI-encode as well.

@cassidoo
Copy link
Member

Great question! Long story short, the URL encoding was added later because of how our image URLs are formed (and some special characters that were output into blogs). The weird characters overall didn't consistently display unless the URL encoding was added.

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

No branches or pull requests

2 participants