Closed yansheng836 closed 4 years ago
疑问:
https://gitee.com/api/v5/repos/yansheng0083/photos 可以访问
数据格式化后:
{
"name": "StatusCodeError",
"statusCode": 404,
"message": "404 - \"{\\\"message\\\":\\\"404 Branch Not Found\\\"}\"",
"error": "{\"message\":\"404 Branch Not Found\"}",
"options": {
"jar": {
"_jar": {
"version": "tough-cookie@2.3.4",
"storeType": "MemoryCookieStore",
"rejectPublicSuffixes": true,
"cookies": []
}
},
"method": "POST",
"url": "https://gitee.com/api/v5/repos/yansheng0083/photos/contents/img/%EF%BC%88%E5%8F%A4%E9%A3%8E%E7%BE%8E%E4%BA%BA%EF%BC%89%E7%BB%98%E5%B8%88%EF%BC%9A%E5%96%B5%E5%96%B5%E4%B9%9D%E5%AD%A3.jpeg",
"headers": {
"contentType": "application/json;charset=UTF-8",
"User-Agent": "PicGo"
},
"formData": {
"access_token": "32893f674f79a9765",
"content": "/9j/4AAQSkZJRgAt5ln9NaNr4GWbp6cYIru/2pcU9YMzI9WZZ8auGC+9LceMNYeiYgvUyFIQ248dtDAWS05qq9VpWOjBVG1LyP//Z",
"message": "upload image"
},
"simple": true,
"resolveWithFullResponse": false,
"transform2xxOnly": false
},
"response": {
"statusCode": 404,
"body": "{\"message\":\"404 Branch Not Found\"}",
"headers": {
"date": "Sun, 23 Aug 2020 04:53:43 GMT",
"content-type": "application/json",
"content-length": "34",
"connection": "close",
"server": "nginx",
"vary": "Origin",
"cache-control": "no-cache",
"x-request-id": "9ee8c6fd2d65027fac10335e5d086b2e",
"x-runtime": "0.197934"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "gitee.com",
"port": 443,
"hostname": "gitee.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/api/v5/repos/yansheng0083/photos/contents/img/%EF%BC%88%E5%8F%A4%E9%A3%8E%E7%BE%8E%E4%BA%BA%EF%BC%89%E7%BB%98%E5%B8%88%EF%BC%9A%E5%96%B5%E5%96%B5%E4%B9%9D%E5%AD%A3.jpeg",
"path": "/api/v5/repos/yansheng0083/photos/contents/img/%EF%BC%88%E5%8F%A4%E9%A3%8E%E7%BE%8E%E4%BA%BA%EF%BC%89%E7%BB%98%E5%B8%88%EF%BC%9A%E5%96%B5%E5%96%B5%E4%B9%9D%E5%AD%A3.jpeg",
"href": "https://gitee.com/api/v5/repos/yansheng0083/photos/contents/img/%EF%BC%88%E5%8F%A4%E9%A3%8E%E7%BE%8E%E4%BA%BA%EF%BC%89%E7%BB%98%E5%B8%88%EF%BC%9A%E5%96%B5%E5%96%B5%E4%B9%9D%E5%AD%A3.jpeg"
},
"method": "POST",
"headers": {
"contentType": "application/json;charset=UTF-8",
"User-Agent": "PicGo",
"content-type": "multipart/form-data; boundary=--------------------------112811183601701927050960",
"content-length": 270855
}
}
}
}
对于疑问的回复:
@yansheng836 针对上传失败的答疑: 根据提示,是你在上传的时候,分支还没创建好。 目前我直接访问:https://gitee.com/yansheng0083/photos 表示分支是可以了,要不,你再试一下?
最后还是不得行的话,你可先在这个地址上测试一下: gitee上的接口测试工具 有需要协助的话,可将测试的结果贴到这个 issue 里哈
我再次测试了下,发现还是之前的问题,看到报错 404 Branch Not Found
以及我的猜想,尝试添加了首个提交,然后就可以了。
按你说的理论上不用先初始化仓库(首次提交),我的这个情况不知道是特例……
还有个小问题,图片URL有点小问题,如:https://gitee.com/yansheng0083/photos/raw/master//2020.jpg,最后面多了个斜杠。添加目录后,也会有:https://gitee.com/yansheng0083/photos/raw/master/img//2020-1.jpg 。
@yansheng836 请升级到2.0.3版本,且更新了readme,表明需要初始化仓库才能上传成功
配置如下:
版本:
日志:(ps:因评论字数限制65536,删除了一部分content内容)