Alex Xu 8 tháng trước cách đây
mục cha
commit
6f69401817
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      src/services/twitterService/index.ts

+ 2 - 1
src/services/twitterService/index.ts

@@ -43,7 +43,8 @@ const tweetUrlReg =
 
 const removeScriptReg = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi
 
-async function genenrateTweetByPublishAPI(url: string): Promise<Tweet> {
+async function genenrateTweetByPublishAPI(urlRaw: string): Promise<Tweet> {
+  const url = urlRaw.trim()
   const match = url.match(tweetUrlReg)
   if (!match) {
     throw new Error('Invalid tweet URL')