【发布时间】:2020-08-06 04:09:51
【问题描述】:
我正在尝试在 Web 应用中的文件夹下列出文件,如下所示:
listRef.listAll().then((res) => {
// I get the list of items here
res.items.forEach((imgRef) => {
// 404 error
imgRef.getDownloadURL().then((url) => {
console.log(url);
mapFile(url, imgRef.metadata);
});
});
});
我成功列出 res.items,但是当我尝试使用 getDownloadURL() 时,我得到了 404 引用,我注意到我得到了 folder/image 在项目的引用中,当我使用 firebase 存储控制台浏览文件时,它会浏览编码为 %2F 的斜杠“/”
我的参考如下:
const storageRef = firebase.app().storage('gs://some-name').ref();
const listRef = storageRef.child(`${Id1}`);
当我保存图像时,我使用以下参考:
const imageRef = storageRef.child(`${Id1}/${this.file.name}`);
编辑:
我得到了默认存储桶作为响应,但是我在存储引用中设置了正确的存储桶端点,这不是默认值。
【问题讨论】:
标签: javascript firebase firebase-storage