gpt4 book ai didi

firebase-storage - 如何升级到 Firebase 存储规则 v2

转载 作者:行者123 更新时间:2023-12-04 11:13:50 24 4
gpt4 key购买 nike

今天,当我尝试更新我的 firebase 存储规则时,我收到了一条关于升级它们的消息。我怎么做?

i  deploying storage
i firebase.storage: checking storage.rules for compilation errors...
⚠ [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).
✔ firebase.storage: rules file storage.rules compiled successfully
i storage: uploading rules storage.rules...
✔ storage: released rules storage.rules to firebase.storage

我的规则是这样的:
service firebase.storage {
match /b/{bucket}/o {
match /user-files/{uid}/{allPaths=**} {
allow read: if resource.metadata[request.auth.uid] == "1"; // the uploading user can get a downloadURL
allow create, update: if request.auth.uid == uid // User can only upload to the users own folder
&& request.auth.token.storageLeft >= request.resource.size
&& request.auth.token.path == request.resource.name
allow delete: if false; // files are only deleted by cloud functions
}
}
}

最佳答案

要将您的规则切换到版本 2,请在顶部添加以下行:

rules_version = "2";
要了解有关规则语言新版本的更多信息,请参阅 getting started 上的文档。 .

关于firebase-storage - 如何升级到 Firebase 存储规则 v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60847344/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com