Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

private仓库传图上传不了 #194

Closed
freeziyou opened this issue Feb 1, 2024 — with GitMaya App · 8 comments
Closed

private仓库传图上传不了 #194

freeziyou opened this issue Feb 1, 2024 — with GitMaya App · 8 comments
Assignees
Labels
bug Something isn't working

Comments

Copy link
Contributor

No description provided.

@freeziyou freeziyou added the bug Something isn't working label Feb 1, 2024 — with GitMaya App
@freeziyou freeziyou self-assigned this Feb 1, 2024
@lloydzhou
Copy link
Contributor

https://docs.github.com/en/rest/markdown/markdown?apiVersion=2022-11-28#render-a-markdown-document

如果是私有仓库,试试用这个先渲染成html。

试试看这个渲染之后的html里面的链接是不是有权限?

@lloydzhou
Copy link
Contributor

![image](https://github.com/ConnectAI-E/GitMaya/assets/1826685/24e5782e-2045-4fd3-80b1-b261ebc497b9)

直接在页面上查看的时候,渲染出来的是带jwt的链接,域名也是https://private-user-images.githubusercontent.com/
image

@freeziyou
Copy link
Contributor Author

image
image
markdown的api并不会做解析,github应该是在markdown渲染器有额外的未公开的上传接口

@lloydzhou
Copy link
Contributor

https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset
往github上传图片,或许可以走这个逻辑。
创建一个draft release
往这个release_id上传assets
从返回的 "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip", 拿到链接,拿这个链接往相同的repo的issue里面填,应该权限就是一样的了。能看,大家都能看。不能看,大家都不能看
下载的时候,把个人的token放到header里面就能下载了

@jingfelix
Copy link
Member

![image](https://github.com/ConnectAI-E/GitMaya/assets/1826685/24e5782e-2045-4fd3-80b1-b261ebc497b9)

直接在页面上查看的时候,渲染出来的是带jwt的链接,域名也是https://private-user-images.githubusercontent.com/ image

能不能用 GitHub App 的 JWT 试一下能否访问?

@freeziyou
Copy link
Contributor Author

@lloydzhou
Copy link
Contributor

我前面的那个消息放错位置了。那个是希望能处理飞书那边的图片传github的问题。

现在github这边私有仓库的图片,可以直接使用用户的token下载,再上传到飞书

@freeziyou
Copy link
Contributor Author

#237 直接显示图片链接,这种方案相当于github帮我们做了权限验证

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants