diff --git a/src/api/export.ts b/src/api/export.ts index 441a5dbc1..7b2937ede 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -202,7 +202,7 @@ async function _export({ const cleaned = clean_html(body); const base_match = //m.exec(cleaned); - const base_href = base_match && get_href(base_match[1]); + const base_href = base_match ? get_href(base_match[1]) : path.dirname(url.pathname); const base = resolve(url.href, base_href); let match; diff --git a/test/apps/export/src/routes/index.svelte b/test/apps/export/src/routes/index.svelte index 457298ad7..7b4c27d99 100644 --- a/test/apps/export/src/routes/index.svelte +++ b/test/apps/export/src/routes/index.svelte @@ -8,4 +8,5 @@ empty anchor #5 empty anchor #6 boom +html file pdf file \ No newline at end of file diff --git a/test/apps/export/static/test.html b/test/apps/export/static/test.html new file mode 100644 index 000000000..ea81abf9b --- /dev/null +++ b/test/apps/export/static/test.html @@ -0,0 +1,13 @@ + + + + + Page Title + + + +

Test Heading

+

Test Paragraph.

+ + + \ No newline at end of file diff --git a/test/apps/export/test.ts b/test/apps/export/test.ts index 850e38635..07c545274 100644 --- a/test/apps/export/test.ts +++ b/test/apps/export/test.ts @@ -41,6 +41,7 @@ describe('export', function() { 'index.html', 'service-worker-index.html', 'service-worker.js', + 'test.html', 'test.pdf', ...boom ].sort());