Skip to content

Commit 19fa062

Browse files
fix(migrate): url
1 parent b6679e3 commit 19fa062

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

migrate/migrate-bot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function retry(fn, retries = 3, delay = 1000) {
4343

4444

4545
function extractLink(title) {
46-
const urlRegex = /cppreference\.com\/w\/[^\s]+/g;
46+
const urlRegex = /https?:\/\/.*?cppreference\.com\/w\/[^\s]+/g;
4747
const match = title.match(urlRegex);
4848
return match ? match[0] : null;
4949
}
@@ -179,7 +179,7 @@ ${html}
179179

180180
function getLocalPath(url) {
181181
// https://en.cppreference.com/w/cpp/comments.html -> src/content/docs/cpp/comments.mdx
182-
const match = url.match(/cppreference\.com\/w\/(.+)\.html$/);
182+
const match = url.match(/https?:\/\/.*?cppreference\.com\/w\/(.+)\.html$/);
183183
if (!match) {
184184
throw new Error(`无法从URL解析路径: ${url}`);
185185
}

0 commit comments

Comments
 (0)