From 0706b5f50ab8f10b5c1d884c14b28a71a02804e3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 3 Sep 2018 09:02:13 -0400 Subject: [PATCH] decode req.path during export --- src/api/export.ts | 2 +- test/app/routes/blog/_posts.js | 8 ++++++++ test/common/test.js | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api/export.ts b/src/api/export.ts index d2bbd40ea..d4deaca71 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -85,7 +85,7 @@ async function execute(emitter: EventEmitter, opts: Opts) { function save(path: string, status: number, type: string, body: string) { const { pathname } = resolve(origin, path); - let file = pathname.slice(1); + let file = decodeURIComponent(pathname.slice(1)); if (saved.has(file)) return; saved.add(file); diff --git a/test/app/routes/blog/_posts.js b/test/app/routes/blog/_posts.js index d5e0dc288..fa73826d0 100644 --- a/test/app/routes/blog/_posts.js +++ b/test/app/routes/blog/_posts.js @@ -106,6 +106,14 @@ const posts = [

If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. Everybody dance NOW. And the soup of the day is bread. Great, now I'm gonna smell to high heaven like a tuna melt!

That's how Tony Wonder lost a nut. She calls it a Mayonegg. Go ahead, touch the Cornballer. There's a new daddy in town. A discipline daddy.

` + }, + + { + title: 'Encödïng test', + slug: 'encödïng-test', + html: ` +

It works

+ ` } ]; diff --git a/test/common/test.js b/test/common/test.js index d192fea74..4db2d30ac 100644 --- a/test/common/test.js +++ b/test/common/test.js @@ -93,6 +93,7 @@ function testExport({ basepath = '' }) { 'blog/how-to-use-sapper/index.html', 'blog/what-is-sapper/index.html', 'blog/why-the-name/index.html', + 'blog/encödïng-test/index.html', 'blog.json', 'blog/a-very-long-post.json', @@ -101,6 +102,7 @@ function testExport({ basepath = '' }) { 'blog/how-to-use-sapper.json', 'blog/what-is-sapper.json', 'blog/why-the-name.json', + 'blog/encödïng-test.json', 'favicon.png', 'global.css',