Skip to content

Commit

Permalink
fix: skip non-URI-encoded exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Feb 28, 2021
1 parent dc588dc commit cfb7962
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/site-transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ export const fixExceptions = async ({
}
const dir = opendirSync(exceptionsDir)
for await (let file of dir) {
const articleName = decodeURIComponent(file.name)
let articleName
try {
articleName = decodeURIComponent(file.name)
} catch (e) {
console.error(`unable to decodeURIComponent(${file.name}): `, e)
continue
}
const segments = articleName.split('/')

// only process exceptions from A/ namespace
Expand Down

0 comments on commit cfb7962

Please sign in to comment.