提交 ce404aba 编写于 作者: DCloud_JSON's avatar DCloud_JSON

修复微信公众号登录时头像格式问题引起的错误

上级 f9f0a760
...@@ -106,7 +106,8 @@ module.exports = async function (params = {}) { ...@@ -106,7 +106,8 @@ module.exports = async function (params = {}) {
openid openid
}) })
// eslint-disable-next-line n/no-deprecated-api // eslint-disable-next-line n/no-deprecated-api
const extName = url.parse(avatar).pathname.split('.').pop() const avatarPath = url.parse(avatar).pathname
const extName = avatarPath.indexOf('.') > -1 ? url.parse(avatar).pathname.split('.').pop() : 'jpg'
const cloudPath = `user/avatar/${openid.slice(-8) + Date.now()}-avatar.${extName}` const cloudPath = `user/avatar/${openid.slice(-8) + Date.now()}-avatar.${extName}`
const getAvatarRes = await uniCloud.httpclient.request(avatar) const getAvatarRes = await uniCloud.httpclient.request(avatar)
if (getAvatarRes.status >= 400) { if (getAvatarRes.status >= 400) {
......
{ {
"name": "uni-id-co", "name": "uni-id-co",
"version": "1.0.0", "version": "1.0.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "uni-id-co", "name": "uni-id-co",
"version": "1.0.0", "version": "1.0.1",
"dependencies": { "dependencies": {
"jsonwebtoken": "8.5.1", "jsonwebtoken": "8.5.1",
"uni-captcha": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha", "lodash.merge": "^4.6.2",
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center", "uni-captcha": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-id-common": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common" "uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
} "uni-id-common": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common",
}, "uni-open-bridge-common": "file:../../../../uni-open-bridge/uniCloud/cloudfunctions/common/uni-open-bridge-common"
"../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha": { }
"version": "0.2.2", },
"license": "Apache-2.0", "../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha": {
"dependencies": { "version": "0.2.2",
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "license": "Apache-2.0",
} "dependencies": {
}, "uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
"../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": { }
"version": "0.0.2", },
"license": "Apache-2.0" "../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": {
}, "version": "0.0.2",
"../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common": { "license": "Apache-2.0"
"version": "1.0.0", },
"license": "Apache-2.0", "../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common": {
"dependencies": { "version": "1.0.13",
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "license": "Apache-2.0",
} "dependencies": {
}, "uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
"../../../../uni-id/uniCloud/cloudfunctions/common/uni-id": { }
"version": "4.0.0", },
"extraneous": true, "../../../../uni-id/uniCloud/cloudfunctions/common/uni-id": {
"license": "Apache-2.0", "version": "4.0.0",
"dependencies": { "extraneous": true,
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "license": "Apache-2.0",
} "dependencies": {
}, "uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
"node_modules/buffer-equal-constant-time": { }
"version": "1.0.1", },
"license": "BSD-3-Clause" "../../../../uni-open-bridge/uniCloud/cloudfunctions/common/uni-open-bridge-common": {
}, "version": "1.0.0",
"node_modules/ecdsa-sig-formatter": { "license": "ISC",
"version": "1.0.11", "dependencies": {
"license": "Apache-2.0", "uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
"dependencies": { }
"safe-buffer": "^5.0.1" },
} "node_modules/buffer-equal-constant-time": {
}, "version": "1.0.1",
"node_modules/jsonwebtoken": { "license": "BSD-3-Clause"
"version": "8.5.1", },
"license": "MIT", "node_modules/ecdsa-sig-formatter": {
"dependencies": { "version": "1.0.11",
"jws": "^3.2.2", "license": "Apache-2.0",
"lodash.includes": "^4.3.0", "dependencies": {
"lodash.isboolean": "^3.0.3", "safe-buffer": "^5.0.1"
"lodash.isinteger": "^4.0.4", }
"lodash.isnumber": "^3.0.3", },
"lodash.isplainobject": "^4.0.6", "node_modules/jsonwebtoken": {
"lodash.isstring": "^4.0.1", "version": "8.5.1",
"lodash.once": "^4.0.0", "license": "MIT",
"ms": "^2.1.1", "dependencies": {
"semver": "^5.6.0" "jws": "^3.2.2",
}, "lodash.includes": "^4.3.0",
"engines": { "lodash.isboolean": "^3.0.3",
"node": ">=4", "lodash.isinteger": "^4.0.4",
"npm": ">=1.4.28" "lodash.isnumber": "^3.0.3",
} "lodash.isplainobject": "^4.0.6",
}, "lodash.isstring": "^4.0.1",
"node_modules/jwa": { "lodash.once": "^4.0.0",
"version": "1.4.1", "ms": "^2.1.1",
"license": "MIT", "semver": "^5.6.0"
"dependencies": { },
"buffer-equal-constant-time": "1.0.1", "engines": {
"ecdsa-sig-formatter": "1.0.11", "node": ">=4",
"safe-buffer": "^5.0.1" "npm": ">=1.4.28"
} }
}, },
"node_modules/jws": { "node_modules/jwa": {
"version": "3.2.2", "version": "1.4.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"jwa": "^1.4.1", "buffer-equal-constant-time": "1.0.1",
"safe-buffer": "^5.0.1" "ecdsa-sig-formatter": "1.0.11",
} "safe-buffer": "^5.0.1"
}, }
"node_modules/lodash.includes": { },
"version": "4.3.0", "node_modules/jws": {
"license": "MIT" "version": "3.2.2",
}, "license": "MIT",
"node_modules/lodash.isboolean": { "dependencies": {
"version": "3.0.3", "jwa": "^1.4.1",
"license": "MIT" "safe-buffer": "^5.0.1"
}, }
"node_modules/lodash.isinteger": { },
"version": "4.0.4", "node_modules/lodash.includes": {
"license": "MIT" "version": "4.3.0",
}, "license": "MIT"
"node_modules/lodash.isnumber": { },
"version": "3.0.3", "node_modules/lodash.isboolean": {
"license": "MIT" "version": "3.0.3",
}, "license": "MIT"
"node_modules/lodash.isplainobject": { },
"version": "4.0.6", "node_modules/lodash.isinteger": {
"license": "MIT" "version": "4.0.4",
}, "license": "MIT"
"node_modules/lodash.isstring": { },
"version": "4.0.1", "node_modules/lodash.isnumber": {
"license": "MIT" "version": "3.0.3",
}, "license": "MIT"
"node_modules/lodash.once": { },
"version": "4.1.1", "node_modules/lodash.isplainobject": {
"license": "MIT" "version": "4.0.6",
}, "license": "MIT"
"node_modules/ms": { },
"version": "2.1.3", "node_modules/lodash.isstring": {
"license": "MIT" "version": "4.0.1",
}, "license": "MIT"
"node_modules/safe-buffer": { },
"version": "5.2.1", "node_modules/lodash.merge": {
"funding": [ "version": "4.6.2",
{ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"type": "github", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
"url": "https://github.com/sponsors/feross" },
}, "node_modules/lodash.once": {
{ "version": "4.1.1",
"type": "patreon", "license": "MIT"
"url": "https://www.patreon.com/feross" },
}, "node_modules/ms": {
{ "version": "2.1.3",
"type": "consulting", "license": "MIT"
"url": "https://feross.org/support" },
} "node_modules/safe-buffer": {
], "version": "5.2.1",
"license": "MIT" "funding": [
}, {
"node_modules/semver": { "type": "github",
"version": "5.7.1", "url": "https://github.com/sponsors/feross"
"license": "ISC", },
"bin": { {
"semver": "bin/semver" "type": "patreon",
} "url": "https://www.patreon.com/feross"
}, },
"node_modules/uni-captcha": { {
"resolved": "../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha", "type": "consulting",
"link": true "url": "https://feross.org/support"
}, }
"node_modules/uni-config-center": { ],
"resolved": "../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center", "license": "MIT"
"link": true },
}, "node_modules/semver": {
"node_modules/uni-id-common": { "version": "5.7.1",
"resolved": "../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common", "license": "ISC",
"link": true "bin": {
} "semver": "bin/semver"
}, }
"dependencies": { },
"buffer-equal-constant-time": { "node_modules/uni-captcha": {
"version": "1.0.1" "resolved": "../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
}, "link": true
"ecdsa-sig-formatter": { },
"version": "1.0.11", "node_modules/uni-config-center": {
"requires": { "resolved": "../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"safe-buffer": "^5.0.1" "link": true
} },
}, "node_modules/uni-id-common": {
"jsonwebtoken": { "resolved": "../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common",
"version": "8.5.1", "link": true
"requires": { },
"jws": "^3.2.2", "node_modules/uni-open-bridge-common": {
"lodash.includes": "^4.3.0", "resolved": "../../../../uni-open-bridge/uniCloud/cloudfunctions/common/uni-open-bridge-common",
"lodash.isboolean": "^3.0.3", "link": true
"lodash.isinteger": "^4.0.4", }
"lodash.isnumber": "^3.0.3", },
"lodash.isplainobject": "^4.0.6", "dependencies": {
"lodash.isstring": "^4.0.1", "buffer-equal-constant-time": {
"lodash.once": "^4.0.0", "version": "1.0.1"
"ms": "^2.1.1", },
"semver": "^5.6.0" "ecdsa-sig-formatter": {
} "version": "1.0.11",
}, "requires": {
"jwa": { "safe-buffer": "^5.0.1"
"version": "1.4.1", }
"requires": { },
"buffer-equal-constant-time": "1.0.1", "jsonwebtoken": {
"ecdsa-sig-formatter": "1.0.11", "version": "8.5.1",
"safe-buffer": "^5.0.1" "requires": {
} "jws": "^3.2.2",
}, "lodash.includes": "^4.3.0",
"jws": { "lodash.isboolean": "^3.0.3",
"version": "3.2.2", "lodash.isinteger": "^4.0.4",
"requires": { "lodash.isnumber": "^3.0.3",
"jwa": "^1.4.1", "lodash.isplainobject": "^4.0.6",
"safe-buffer": "^5.0.1" "lodash.isstring": "^4.0.1",
} "lodash.once": "^4.0.0",
}, "ms": "^2.1.1",
"lodash.includes": { "semver": "^5.6.0"
"version": "4.3.0" }
}, },
"lodash.isboolean": { "jwa": {
"version": "3.0.3" "version": "1.4.1",
}, "requires": {
"lodash.isinteger": { "buffer-equal-constant-time": "1.0.1",
"version": "4.0.4" "ecdsa-sig-formatter": "1.0.11",
}, "safe-buffer": "^5.0.1"
"lodash.isnumber": { }
"version": "3.0.3" },
}, "jws": {
"lodash.isplainobject": { "version": "3.2.2",
"version": "4.0.6" "requires": {
}, "jwa": "^1.4.1",
"lodash.isstring": { "safe-buffer": "^5.0.1"
"version": "4.0.1" }
}, },
"lodash.once": { "lodash.includes": {
"version": "4.1.1" "version": "4.3.0"
}, },
"ms": { "lodash.isboolean": {
"version": "2.1.3" "version": "3.0.3"
}, },
"safe-buffer": { "lodash.isinteger": {
"version": "5.2.1" "version": "4.0.4"
}, },
"semver": { "lodash.isnumber": {
"version": "5.7.1" "version": "3.0.3"
}, },
"uni-captcha": { "lodash.isplainobject": {
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha", "version": "4.0.6"
"requires": { },
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "lodash.isstring": {
} "version": "4.0.1"
}, },
"uni-config-center": { "lodash.merge": {
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "version": "4.6.2",
}, "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"uni-id-common": { "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
"version": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common", },
"requires": { "lodash.once": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "version": "4.1.1"
} },
} "ms": {
} "version": "2.1.3"
},
"safe-buffer": {
"version": "5.2.1"
},
"semver": {
"version": "5.7.1"
},
"uni-captcha": {
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"requires": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
},
"uni-config-center": {
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"uni-id-common": {
"version": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common",
"requires": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
},
"uni-open-bridge-common": {
"version": "file:../../../../uni-open-bridge/uniCloud/cloudfunctions/common/uni-open-bridge-common",
"requires": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
} }
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
"uni-id-common": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common", "uni-id-common": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common",
"uni-open-bridge-common": "file:../../../../uni-open-bridge/uniCloud/cloudfunctions/common/uni-open-bridge-common" "uni-open-bridge-common": "file:../../../../uni-open-bridge/uniCloud/cloudfunctions/common/uni-open-bridge-common"
}, },
"extensions": {}, "extensions": {}
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册