Skip to content

Commit

Permalink
fix: 消息包含无效 url 时转发失败
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Nov 14, 2024
1 parent 64ddf17 commit ef6b0ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main/src/constants/regExps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
qq: /^[1-9]\d{4,10}$/,
roomId: /^-?[1-9]\d{4,10}$/,
url: /https?:\/\/[-A-Za-z0-9+&@#\/%?=~_|!:,.;]+[-A-Za-z0-9+&@#\/%=~_|]/,
url: /https?:\/\/[-a-zA-Z0-9@%._+~#=]{1,256}\.[a-zA-Z]{2,6}\b[-a-zA-Z0-9@:%_+.~#?&\/=]*/,
};
4 changes: 4 additions & 0 deletions main/src/services/ForwardService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@ export default class ForwardService {
message && (messageToSend.message = message);
tgMessage = await pair.tg.sendMessage(messageToSend);
}
else if (messageToSend.file instanceof Api.InputMediaWebPage) {
delete messageToSend.file;
tgMessage = await pair.tg.sendMessage(messageToSend);
}
else throw e;
}

Expand Down

0 comments on commit ef6b0ac

Please sign in to comment.