Casbin = way to authorization
A place for Casbin developers and users
现在注册
已注册用户请  登录
主题样式选择
默认主题样式 ✅
知乎主题样式 
admin
Casnode  ›  问与答

image can not upload bug

  •  
  •  
    admin · 2年前 · 93 次点击 
    这是一个创建于 674 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ??

    https://forum.casbin.com/edit/topic/1311

    image can not upload !.

    无法使用媒体库功能。

    测试验证,发现,腾讯云对象存储,可以正常上传到存储筒中,但是 casdoor-go-sdk 代码存在 bug

    https://github.com/casdoor/casdoor-go-sdk/blob/master/casdoorsdk/resource.go

    这段代码有问题,没有正确获得 fileUrl

    不知道这个函数调用的具体的腾讯云对象存储的 url 是多少。

    官方文档参考:

    https://cloud.tencent.com/document/product/436/14690

    总之返回值 resp 的解析 有问题。

    func (c *Client) UploadResource (user string, tag string, parent string, fullFilePath string, fileBytes [] byte) (string, string, error) {
    queryMap := map [string] string {
    "owner": c.OrganizationName,
    "user": user,
    "application": c.ApplicationName,
    "tag": tag,
    "parent": parent,
    "fullFilePath": fullFilePath,
    }

    resp, err := c.DoPost ("upload-resource", queryMap, fileBytes, true, true)
    if err != nil {
    return "", "", err
    }

    fileUrl := resp.Data.(string)
    name := resp.Data2.(string)
    return fileUrl, name, nil
    }
    93 次点击  ∙  0 人收藏  
      Tweet Weibo 忽略主题 
    目前尚无回复
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   50 人在线   最高记录 50   ·     选择语言  ·     选择编辑器
    创意工作者们的社区
    World is powered by code
    VERSION: 6f2aea9 · 12ms · UTC 07:06 · PVG 15:06 · LAX 00:06 · JFK 03:06
    ♥ Do have faith in what you're doing.