Skip to content

Commit 8cbc9ef

Browse files
committed
Escape preview links
1 parent 5c34c08 commit 8cbc9ef

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

scripts/build.mjs

+16-16
Original file line numberDiff line numberDiff line change
@@ -237,19 +237,19 @@ async function generatePubLinks(buildPaths, pubLinks) {
237237

238238
if (pubLinks) {
239239
if ("clean" in pubLinks)
240-
linksDocContents += `[Clean](${encodeURI(pubLinks.clean)})\n`;
240+
linksDocContents += `[Clean](${pubLinks.clean})\n`;
241241

242242
if ("pdf" in pubLinks)
243-
linksDocContents += `[Clean PDF](${encodeURI(pubLinks.pdf)})\n`;
243+
linksDocContents += `[Clean PDF](${pubLinks.pdf})\n`;
244244

245245
if ("baseRedline" in pubLinks)
246-
linksDocContents += `[Redline to current draft](${encodeURI(pubLinks.baseRedline)})\n`;
246+
linksDocContents += `[Redline to current draft](${pubLinks.baseRedline})\n`;
247247

248248
if ("pubRedline" in pubLinks)
249-
linksDocContents += `[Redline to most recent edition](${encodeURI(pubLinks.pubRedline)})\n`;
249+
linksDocContents += `[Redline to most recent edition](${pubLinks.pubRedline})\n`;
250250

251251
if ("reviewZip" in pubLinks)
252-
linksDocContents += `[ZIP package](${encodeURI(pubLinks.reviewZip)})\n`;
252+
linksDocContents += `[ZIP package](${pubLinks.reviewZip})\n`;
253253

254254
} else {
255255
linksDocContents += "No links available";
@@ -287,23 +287,23 @@ async function s3Upload(buildPaths, versionKey, generatedFiles) {
287287
}
288288

289289
if ("pdf" in generatedFiles) {
290-
pubLinks.pdf = `${deployPrefix}${s3PubKeyPrefix}${generatedFiles.pdf}`;
290+
pubLinks.pdf = `${deployPrefix}${s3PubKeyPrefix}${encodeURIComponent(generatedFiles.pdf)}`;
291291
}
292292

293293
if ("baseRedline" in generatedFiles) {
294-
pubLinks.baseRedline = `${deployPrefix}${s3PubKeyPrefix}${generatedFiles.baseRedline}`;
294+
pubLinks.baseRedline = `${deployPrefix}${s3PubKeyPrefix}${encodeURIComponent(generatedFiles.baseRedline)}`;
295295
}
296296

297297
if ("pubRedline" in generatedFiles) {
298-
pubLinks.pubRedline = `${deployPrefix}${s3PubKeyPrefix}${generatedFiles.pubRedline}`;
298+
pubLinks.pubRedline = `${deployPrefix}${s3PubKeyPrefix}${encodeURIComponent(generatedFiles.pubRedline)}`;
299299
}
300300

301301
if ("reviewZip" in generatedFiles) {
302-
pubLinks.reviewZip = `${deployPrefix}${s3PubKeyPrefix}${generatedFiles.reviewZip}`;
302+
pubLinks.reviewZip = `${deployPrefix}${s3PubKeyPrefix}${encodeURIComponent(generatedFiles.reviewZip)}`;
303303
}
304304

305305
if ("libraryZip" in generatedFiles) {
306-
pubLinks.libraryZip = `${deployPrefix}${s3PubKeyPrefix}${generatedFiles.libraryZip}`;
306+
pubLinks.libraryZip = `${deployPrefix}${s3PubKeyPrefix}${encodeURIComponent(generatedFiles.libraryZip)}`;
307307
}
308308

309309
s3SyncDir(buildPaths.pubDirPath, s3Client, s3Bucket, s3PubKeyPrefix);
@@ -372,27 +372,27 @@ async function makePubArtifacts(buildPaths, generatedFiles, docMetadata) {
372372
let htmlLinks;
373373

374374
if ("html" in generatedFiles) {
375-
htmlLinks = `<p><a href="${encodeURI(generatedFiles.html)}">Clean</a></p>\n`;
375+
htmlLinks = `<p><a href="${encodeURIComponent(generatedFiles.html)}">Clean</a></p>\n`;
376376
}
377377

378378
if ("pdf" in generatedFiles) {
379-
htmlLinks += `<p><a href="${encodeURI(generatedFiles.pdf)}">Clean PDF</a></p>\n`;
379+
htmlLinks += `<p><a href="${encodeURIComponent(generatedFiles.pdf)}">Clean PDF</a></p>\n`;
380380
}
381381

382382
if ("baseRedline" in generatedFiles) {
383-
htmlLinks += `<p><a href="${encodeURI(generatedFiles.baseRedline)}">Redline to current draft</a></p>\n`;
383+
htmlLinks += `<p><a href="${encodeURIComponent(generatedFiles.baseRedline)}">Redline to current draft</a></p>\n`;
384384
}
385385

386386
if ("pubRedline" in generatedFiles) {
387-
htmlLinks += `<p><a href="${encodeURI(generatedFiles.pubRedline)}">Redline to most recent edition</a></p>\n`;
387+
htmlLinks += `<p><a href="${encodeURIComponent(generatedFiles.pubRedline)}">Redline to most recent edition</a></p>\n`;
388388
}
389389

390390
if (generatedFiles.reviewZip !== undefined) {
391-
htmlLinks += `<p><a href="${encodeURI(generatedFiles.reviewZip)}">Review zip file</a></p>\n`;
391+
htmlLinks += `<p><a href="${encodeURIComponent(generatedFiles.reviewZip)}">Review zip file</a></p>\n`;
392392
}
393393

394394
if (generatedFiles.libraryZip !== undefined) {
395-
htmlLinks += `<p><a href="${encodeURI(generatedFiles.libraryZip)}">Library zip file</a></p>\n`;
395+
htmlLinks += `<p><a href="${encodeURIComponent(generatedFiles.libraryZip)}">Library zip file</a></p>\n`;
396396
}
397397

398398
fs.writeFileSync(buildPaths.pubArtifactsPath, `<!DOCTYPE html>

0 commit comments

Comments
 (0)