From e3aa7aeb721113eb6baadde26435212aa41f1ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sun, 12 Mar 2017 02:00:32 +0800 Subject: [PATCH] fix: base64encode crash if number given --- lib/main.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.js b/lib/main.js index 363334c..e1f21a6 100755 --- a/lib/main.js +++ b/lib/main.js @@ -172,7 +172,7 @@ class C { */ base64encode(str, urlFriendly){ if(!Buffer.isBuffer(str)) - str = Buffer.from(str) + str = Buffer.from(str + '') let encode = str.toString('base64') if(urlFriendly) encode = encode.replace(/[+\/]/g, m => {return m === '+' ? '-' : '_'}).replace(/=/g, '') diff --git a/package.json b/package.json index 852ad64..f0a7e09 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crypto.js", - "version": "1.0.0", + "version": "1.0.1", "description": "原生crypto加密模块的二次封装,简化常用加密函数的使用", "keywords": [ "md5",