Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Fix 2 issues with custom html files in export #1118

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fc0a759
Revert "leftover css should read from unclaimed modules (#1098)"
Conduitry Mar 12, 2020
9068f42
export: Fix issues with custom html files in export
jamesjnadeau Mar 13, 2020
a386a30
use https URL when updating mime-types.md
Conduitry Mar 20, 2020
71e39cc
update mime-types.md
Conduitry Mar 20, 2020
63ffe90
fix vulnerability when serving /client/... files
Conduitry Mar 20, 2020
5e2c686
-> v0.27.11
Conduitry Mar 20, 2020
facbd96
bundle mime/lite for MIME type lookups (#1138)
Conduitry Apr 1, 2020
b0f342a
-> v0.27.12
Conduitry Apr 1, 2020
8bcdfad
allow multiple slugs in route segment (#1000)
JohnPeel May 4, 2020
d7b8ae1
update changelog
Conduitry May 4, 2020
3bf058c
fix deeplinks no matter previous scroll position (#1139)
ArkaneMoose May 4, 2020
87fe373
update changelog
Conduitry May 4, 2020
621cc6a
set scrollRestoration to auto for page refresh (#1117)
arekbartnik May 4, 2020
ca36457
update changelog
Conduitry May 4, 2020
85fcec1
when copying files during export, preserve atime and mtime (#1111)
ribizli May 4, 2020
fffdbc6
update changelog
Conduitry May 4, 2020
9d58d8f
docs: clarify assumptions made by `preload` (#1135)
natevaughan May 13, 2020
25bad80
update LICENSE copyright year (#1100)
heithemmoumni May 13, 2020
9e5a140
do not notify $page subscribers until after navigation (#1165)
pchynoweth May 13, 2020
a04f319
update changelog
Conduitry May 13, 2020
4a0ffd1
when exporting, do not create directories for page routes ending in .…
NOtherDev May 13, 2020
769226e
update changelog
Conduitry May 13, 2020
d02238c
recognize TypeScript configuration files for Rollup and webpack (#1005)
May 13, 2020
6097e5f
update changelog
Conduitry May 13, 2020
2b8601b
-> v0.27.13
Conduitry May 13, 2020
69cce85
docs: Zeit -> Vercel (#1190)
JB1905 May 13, 2020
de7370e
export: Fix issues with custom html files in export
jamesjnadeau Mar 13, 2020
a70966d
Merge branch 'patch-1' of github.com:jamesjnadeau/sapper into patch-1
jamesjnadeau May 17, 2020
27c418c
:cop: fix formatting to match project style guide
jamesjnadeau May 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/api/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ async function _export({
const is_html = type === 'text/html';

if (is_html) {
if (pathname !== '/service-worker-index.html') {
if (pathname !== '/service-worker-index.html'
&& pathname.substr(pathname.length - 5) !== '.html') {
file = file === '' ? 'index.html' : `${file}/index.html`;
}
body = minify_html(body);
Expand Down Expand Up @@ -186,7 +187,7 @@ async function _export({
const cleaned = clean_html(body);

const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
const base_href = base_match && get_href(base_match[1]);
const base_href = base_match ? get_href(base_match[1]) : '/'
Copy link
Member

Choose a reason for hiding this comment

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

nit: don't need the extra space before base_match and should add a semi-colon to the end of the line

const base = resolve(url.href, base_href);

let match;
Expand Down
1 change: 1 addition & 0 deletions test/apps/export/src/routes/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<a href>empty anchor #5</a>
<a>empty anchor #6</a>
<a href="boom">boom</a>
<a href="test.html">html file</a>
<a href="test.pdf">pdf file</a>
13 changes: 13 additions & 0 deletions test/apps/export/static/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>

<head>
<title>Page Title</title>
</head>

<body>
<h1>Test Heading</h1>
<p>Test Paragraph.</p>
</body>

</html>
1 change: 1 addition & 0 deletions test/apps/export/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('export', function() {
'index.html',
'service-worker-index.html',
'service-worker.js',
'test.html',
'test.pdf',
...boom
].sort());
Expand Down