获取上传到云存储上的对象的公共URL [英] Get public url for object uploaded on cloud storage

查看:273
本文介绍了获取上传到云存储上的对象的公共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> 

这篇关于获取上传到云存储上的对象的公共URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆