Skip to content

Commit

Permalink
Fix special characters error
Browse files Browse the repository at this point in the history
  • Loading branch information
cjaewon committed Apr 29, 2021
1 parent 1c1c01b commit 9201ecd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crawler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ class Crawler {
}

async writePost(post) {
const excludedChar = ['\\', '/', ':' ,'*' ,'?' ,'"' ,'<' ,'>' ,'|'];
const excludedChar = ['\\\\', '/', ':' ,'\\*' ,'\\?' ,'"' ,'<' ,'>' ,'\\|'];
let title = post.title;

for (const char of excludedChar) {
title = title.replace(char, '');
const re = new RegExp(char, 'g');
title = title.replace(re, '');
}

const path = join('backup', 'content', `${title}.md`);
Expand Down

0 comments on commit 9201ecd

Please sign in to comment.