Firebase 3 Storage don't allow file updating/overwriting

后端 未结 1 1801
日久生厌
日久生厌 2021-01-13 11:41

Is there a method/ruleset for Firebase 3 storage to disable file updating or overwriting?

I found data.exists() for Database but no solution for Storage.

相关标签:
1条回答
  • 2021-01-13 11:54

    TL;DR: In Storage Security Rules, request.resource ~= newData.val() and resource ~= data.val(), so you can use them similarly.

    service firebase.storage {
      match /b/<bucket>/o {
        match /path/to/file {
          allow write: if resource == null; // if !data.exists() in DB land
        }
      }
    }
    
    0 讨论(0)
提交回复
热议问题