Firebase存储下载URL文件结构 [英] Firebase storage downloadURL file structure
问题描述
因此,我正在使用Firebase存储上载我的网站文件.这是目录结构的示例:
So I'm using firebase storage to upload my website files. Here is an example of the directory structure:
Project
├── index.html
├── css
│ └── style.css
└── js
└── mainScript.js
所以我将这些文件以这种结构上传到Firebase,但是我注意到返回的downloadURL在保留此结构方面不是很友好.
So I'm uploading these files to firebase in this structure, but I notice that the downloadURL that's returned is not very friendly in preserving this structure..
例如,当我将iframe的src设置为index.html的downloadURL时.iframe页面缺少样式和mainScript文件.
For example, when I set the src of an iframe to the downloadURL for the index.html.. the iframe page is missing the style and mainScript files.
这是downloadURL查找index.html的方式:
This is how the downloadURL looks for index.html:
这是downloadURL查找style.css的方式:
This is how the downloadURL looks for style.css:
当然index.html文件正在以下位置查找style.css文件:
Of course the index.html file is looking for the style.css file at:
https://firebasestorage.googleapis .com/v0/b/App_ID.appspot.com/o/css/style.css
但结果为404.
有没有办法解决这个问题?
Is there a way around this problem?
PS,当然,我不想强迫用户更改其文件中的网址...
PS, Of course I don't want to force the user to change the urls in their files...
推荐答案
不要使用存储来保存您的网站文件!改用Firebase托管... Firebase存储旨在存储上传/下载的文件(图像,音频等)
Don't use the storage to save your website files! Use Firebase hosting instead ... Firebase storage is designed for storing upload/download files (image, audio, etc.)
https://firebase.google.com/docs/hosting/
这篇关于Firebase存储下载URL文件结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!