소스 검색

fix querying usernames with leading @

Mike L 2 년 전
부모
커밋
166299c58f
2개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 1
      dist/twitter.js
  2. 2 1
      src/twitter.ts

+ 2 - 1
dist/twitter.js

@@ -44,6 +44,7 @@ exports.linkBuilder = linkBuilder;
 class ScreenNameNormalizer {
     static normalizeLive(username) {
         return __awaiter(this, void 0, void 0, function* () {
+            username = this.normalize(username);
             if (this._queryUser) {
                 return yield this._queryUser(username)
                     .then(userNameId => userNameId.split(':')[0])
@@ -55,7 +56,7 @@ class ScreenNameNormalizer {
                     return null;
                 });
             }
-            return this.normalize(username);
+            return username;
         });
     }
 }

+ 2 - 1
src/twitter.ts

@@ -51,6 +51,7 @@ export class ScreenNameNormalizer {
   public static normalize = (username: string) => username.toLowerCase().replace(/^@/, '');
 
   public static async normalizeLive(username: string) {
+    username = this.normalize(username);
     if (this._queryUser) {
       return await this._queryUser(username)
         .then(userNameId => userNameId.split(':')[0])
@@ -62,7 +63,7 @@ export class ScreenNameNormalizer {
           return null;
         });
     }
-    return this.normalize(username);
+    return username;
   }
 }