-
Notifications
You must be signed in to change notification settings - Fork 13
/
storage.rules
41 lines (41 loc) · 1.52 KB
/
storage.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /boards {
match /{boardId}/{articleId} {
allow read: if true
allow write: if request.auth != null
&& articleId.split('-')[1] == request.auth.uid + '.md'
&& request.resource != null
&& (
request.resource.size < 5 * 1024 * 1024
&& request.resource.contentType.matches('application/octet-stream')
&& (resource == null || request.resource.contentType == resource.contentType)
)
// && articleId.size() == 16
}
}
match /images {
match /public {
allow read: if true
match /{imageId} {
allow read: if true
allow write: if request.auth != null
}
}
match /boards {
match /{boardId}/{articleId}/{imageId} {
allow read: if true
allow write: if request.auth != null
&& imageId.split('-')[1] == request.auth.uid
&& (
request.resource.size < 5 * 1024 * 1024
&& request.resource.contentType.matches('image/.*')
&& (resource == null || request.resource.contentType == resource.contentType)
)
// && articleId.size() == 16
}
}
}
}
}