gpake / qiniu-wxapp-sdk

qiniu SDK based on wxapp
GNU General Public License v3.0
703 stars 278 forks source link

updateConfigWithOptions options.region非空判断不严谨,upload传参{key: fileName}时提示错误 #22

Closed GuoliangWang closed 6 years ago

GuoliangWang commented 6 years ago
function updateConfigWithOptions(options) {
    if (options.region) {
        config.qiniuRegion = options.region;
    } else {
        console.error('qiniu uploader need your bucket region');
**//可以改成 
//      if (config.qiniuRegion == '' || config.qiniuRegion == null) {
//        console.error('qiniu uploader need your bucket region');
//      }**
    }
    if (options.uptoken) {
        config.qiniuUploadToken = options.uptoken;
    } else if (options.uptokenURL) {
        config.qiniuUploadTokenURL = options.uptokenURL;
    } else if(options.uptokenFunc) {
        config.qiniuUploadTokenFunction = options.uptokenFunc;
    }
    if (options.domain) {
        config.qiniuImageURLPrefix = options.domain;
    }
    config.qiniuShouldUseQiniuFileName = options.shouldUseQiniuFileName;
}
gpake commented 6 years ago

多谢多谢。有兴趣的话,不妨一起来维护这个项目呀

gpake commented 6 years ago

btw这个地方我还是打算使用 null 来直接判断就好,空字符串严格意义上来说,并不是空,而是一个无效的输入,而值的有效性判断,会在上传的时候利用 uploadURLFromRegionCode 方法一并检查