相关疑难解决方法(0)

Firebase 存储 downloadURL 文件结构

所以我使用 firebase 存储来上传我的网站文件。以下是目录结构的示例:

\n\n
Project\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 css\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 style.css\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 js\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 mainScript.js\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,我以这种结构将这些文件上传到 firebase,但我注意到返回的 downloadURL 在保留这种结构方面不是很友好。

\n\n

例如,当我将 iframe 的 src 设置为 index.html.. 的 downloadURL 时,iframe 页面缺少样式和 mainScript 文件。

\n\n

这是 downloadURL 查找 index.html 的方式:

\n\n

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/index.html?alt=media&token=some_uid

\n\n

这是 downloadURL 查找 style.css 的方式:

\n\n

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css%2Fstyle.css?alt=media&token=some_uid \netc..

\n\n

当然,index.html 文件正在寻找 style.css 文件:

\n\n

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css/style.css

\n\n

但结果是 404。

\n\n

有办法解决这个问题吗?

\n\n
\n

PS,当然我不想强迫用户更改文件中的网址......

\n
\n

firebase firebase-hosting firebase-storage

5
推荐指数
1
解决办法
3181
查看次数