获取上传到云存储上的对象的公共URL
问题描述:
我在云存储上上传了一个pdf文件.但是当我访问url https://storage.cloud.google.com /[BUCKET]/[FILE].jpg 我被重定向到google登录页面.有没有办法获取可以直接访问文件且没有CORS问题的公共URL.
I uploaded a pdf file on cloud storage. But when i access url https://storage.cloud.google.com/[BUCKET]/[FILE].jpg i am redirected to google signin page. Is there any way to get a public url which gives direct access to file and doesnt have CORS issues.
答
这是一个愚蠢的错误. 使用
It was silly mistake. Use
storage.googleapis.com/<bucketName>/<fileName>
代替
storage.cloud.google .com/<bucketName>/<fileName>