fix: wbiSign

This commit is contained in:
My-Responsitories
2025-04-02 18:52:13 +08:00
parent f64d543ec7
commit d1a6798f2e
2 changed files with 7 additions and 4 deletions

View File

@@ -1676,7 +1676,9 @@ class Utils {
return base64.encode(randomBytes); return base64.encode(randomBytes);
} }
static String getFileName(String uri) { static String getFileName(String uri, {bool fileExt = true}) {
return uri.substring(uri.lastIndexOf('/') + 1); final i0 = uri.lastIndexOf('/') + 1;
final i1 = fileExt ? uri.length : uri.lastIndexOf('.');
return uri.substring(i0, i1);
} }
} }

View File

@@ -83,8 +83,9 @@ class WbiSign {
if (resp.data['code'] == 0) { if (resp.data['code'] == 0) {
final wbiUrls = resp.data['data']['wbi_img']; final wbiUrls = resp.data['data']['wbi_img'];
mixinKey = getMixinKey(Utils.getFileName(wbiUrls['img_url']) + mixinKey = getMixinKey(
Utils.getFileName(wbiUrls['sub_url'])); Utils.getFileName(wbiUrls['img_url'], fileExt: false) +
Utils.getFileName(wbiUrls['sub_url'], fileExt: false));
localCache.put(LocalCacheKey.mixinKey, mixinKey); localCache.put(LocalCacheKey.mixinKey, mixinKey);
localCache.put(LocalCacheKey.timeStamp, nowDate.millisecondsSinceEpoch); localCache.put(LocalCacheKey.timeStamp, nowDate.millisecondsSinceEpoch);