mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-03-21 22:49:42 +02:00
[#6152] skip the default body size limit for the backup endpoint
This commit is contained in:
parent
2ebc6aecac
commit
f6407b903b
@ -1,5 +1,7 @@
|
|||||||
## v0.23.12 (WIP)
|
## v0.23.12 (WIP)
|
||||||
|
|
||||||
|
- Skipped the default body size limit middleware for the backup upload endpooint ([#6152](https://github.com/pocketbase/pocketbase/issues/6152)).
|
||||||
|
|
||||||
- Added warning logs in case of mismatched `modernc.org/sqlite` and `modernc.org/libs` versions ([#6136](https://github.com/pocketbase/pocketbase/issues/6136#issuecomment-2556336962)).
|
- Added warning logs in case of mismatched `modernc.org/sqlite` and `modernc.org/libs` versions ([#6136](https://github.com/pocketbase/pocketbase/issues/6136#issuecomment-2556336962)).
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ func bindBackupApi(app core.App, rg *router.RouterGroup[*core.RequestEvent]) {
|
|||||||
sub := rg.Group("/backups")
|
sub := rg.Group("/backups")
|
||||||
sub.GET("", backupsList).Bind(RequireSuperuserAuth())
|
sub.GET("", backupsList).Bind(RequireSuperuserAuth())
|
||||||
sub.POST("", backupCreate).Bind(RequireSuperuserAuth())
|
sub.POST("", backupCreate).Bind(RequireSuperuserAuth())
|
||||||
sub.POST("/upload", backupUpload).Bind(RequireSuperuserAuth())
|
sub.POST("/upload", backupUpload).Bind(BodyLimit(0), RequireSuperuserAuth())
|
||||||
sub.GET("/{key}", backupDownload) // relies on superuser file token
|
sub.GET("/{key}", backupDownload) // relies on superuser file token
|
||||||
sub.DELETE("/{key}", backupDelete).Bind(RequireSuperuserAuth())
|
sub.DELETE("/{key}", backupDelete).Bind(RequireSuperuserAuth())
|
||||||
sub.POST("/{key}/restore", backupRestore).Bind(RequireSuperuserAuth())
|
sub.POST("/{key}/restore", backupRestore).Bind(RequireSuperuserAuth())
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/pocketbase/pocketbase/apis"
|
||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
"github.com/pocketbase/pocketbase/tests"
|
"github.com/pocketbase/pocketbase/tests"
|
||||||
"gocloud.dev/blob"
|
"gocloud.dev/blob"
|
||||||
@ -346,6 +347,19 @@ func TestBackupUpload(t *testing.T) {
|
|||||||
ExpectedStatus: 204,
|
ExpectedStatus: 204,
|
||||||
ExpectedEvents: map[string]int{"*": 0},
|
ExpectedEvents: map[string]int{"*": 0},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "ensure that the default body limit is skipped",
|
||||||
|
Method: http.MethodPost,
|
||||||
|
URL: "/api/backups/upload",
|
||||||
|
Body: bytes.NewBuffer(make([]byte, apis.DefaultMaxBodySize+100)),
|
||||||
|
Headers: map[string]string{
|
||||||
|
"Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhdXRoIiwiY29sbGVjdGlvbklkIjoicGJjXzMxNDI2MzU4MjMiLCJleHAiOjI1MjQ2MDQ0NjEsInJlZnJlc2hhYmxlIjp0cnVlfQ.UXgO3j-0BumcugrFjbd7j0M4MQvbrLggLlcu_YNGjoY",
|
||||||
|
},
|
||||||
|
ExpectedStatus: 400, // it doesn't matter as long as it is not 413
|
||||||
|
ExpectedContent: []string{`"data":{`},
|
||||||
|
NotExpectedContent: []string{"entity too large"},
|
||||||
|
ExpectedEvents: map[string]int{"*": 0},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, scenario := range scenarios {
|
for _, scenario := range scenarios {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user