Skip to content

Commit b1cda5b

Browse files
author
jjeejj
committed
解决文章标题中包含 路径分隔符 / 的bug
1 parent 47aaec9 commit b1cda5b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

columnArticleList.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ const downloadAudio = require('./downloadAudio.js');
4545
audioTitle: columnArticle.audio_title
4646
};
4747
columnArticleUrlList.push(articleInfo);
48+
// 替换文章名称的 / 线, 解决路径被分割的问题
49+
let useArticleTtle = columnArticle.article_title.replace(/\//g, '-');
4850
//生成PDF
4951
await generaterPdf(articleInfo,
50-
columnArticle.article_title + '.pdf',
52+
useArticleTtle + '.pdf',
5153
path.resolve(__dirname, 'geektime_' + config.columnName)
5254
);
5355
// 是否下载音频
5456
if (config.isdownloadVideo) {
5557
await downloadAudio(
5658
columnArticle.audio_download_url,
57-
columnArticle.article_title + '.mp3',
59+
useArticleTtle + '.mp3',
5860
path.resolve(__dirname, 'geektime_' + config.columnName)
5961
);
6062
};

0 commit comments

Comments
 (0)