Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以使用edgee:slingshot文件上传器为meteor上传文件,而无需在meteor中创建用户帐户?_Meteor_Meteor Slingshot - Fatal编程技术网

是否可以使用edgee:slingshot文件上传器为meteor上传文件,而无需在meteor中创建用户帐户?

是否可以使用edgee:slingshot文件上传器为meteor上传文件,而无需在meteor中创建用户帐户?,meteor,meteor-slingshot,Meteor,Meteor Slingshot,我正在尝试创建一个简单的评论表单,访问者可以在其中创建评论。注释将是:comment={name:“string”,body:“string”,image:“string”} 我想任何人都可以创建一个评论,并上传图像,而无需创建一个用户帐户。动机是为了纪念一位去世的朋友。访问者应该能够上传一个内存图片,而无需创建帐户 当我尝试将该文件上载到AWS时,出现以下错误: TypeError: Meteor.userId is not a function userId: Meteor.userId

我正在尝试创建一个简单的评论表单,访问者可以在其中创建评论。注释将是:comment={name:“string”,body:“string”,image:“string”}

我想任何人都可以创建一个评论,并上传图像,而无需创建一个用户帐户。动机是为了纪念一位去世的朋友。访问者应该能够上传一个内存图片,而无需创建帐户

当我尝试将该文件上载到AWS时,出现以下错误:

TypeError: Meteor.userId is not a function


userId: Meteor.userId()                                                 // 70
我在那一行设置了一个断点,发现第70行中的Meteor.userId()未定义

validate: function(file) {                                                  // 68
      var context = {                                                           // 69
        userId: Meteor.userId()                                                 // 70
      };                                                                    

    // 71
      try {                                                                     // 72
        var validators = Slingshot.Validators,                                  // 73
            restrictions = Slingshot.getRestrictions(directive);                // 74
                                                                                // 75
        validators.checkAll(context, file, metaData, restrictions) && null;     // 76
      } catch(error) {                                                          // 77
        return error;                                                           // 78
      }                                                                         // 79
    },      

是否有任何方法可以禁止Meteor.userId()通过API干净地上传带有
slingshot
的文件?或者让人们注册并登录,这样Meteor.userId()就可以使用了

上传时不需要用户ID。但是当您使用validate时,您必须添加accounts包。您需要添加至少一个登录提供程序包:帐户密码或

现在看起来像是一个bug。

它是弹弓中的一个漏洞,但也许你可以解决它,直到它被修复为止

if (!Meteor.userId)
  Meteor.userId = function () {};
请注意,此声明必须在使用slingshot之前出现,如果应用程序的任何部分依赖于未定义的
Meteor.userId
作为未启用帐户的标志,则此更改可能会破坏您的应用程序。

这是slingshot中的一个错误:在版本0.3.0中引入。