mirror of
https://github.com/versity/versitygw.git
synced 2026-01-08 12:41:10 +00:00
Merge pull request #1270 from versity/ben/event-log-panic
fix: panic with malformed request in event/log handlers
This commit is contained in:
@@ -141,7 +141,12 @@ func InitEventSender(cfg *EventConfig) (S3EventSender, error) {
|
||||
|
||||
func createEventSchema(ctx *fiber.Ctx, meta EventMeta, configId ConfigurationId) EventSchema {
|
||||
path := strings.Split(ctx.Path(), "/")
|
||||
bucket, object := path[1], strings.Join(path[2:], "/")
|
||||
|
||||
var bucket, object string
|
||||
if len(path) > 1 {
|
||||
bucket, object = path[1], strings.Join(path[2:], "/")
|
||||
}
|
||||
|
||||
acc := ctx.Locals("account").(auth.Account)
|
||||
|
||||
return EventSchema{
|
||||
|
||||
@@ -68,7 +68,10 @@ func (f *FileLogger) Log(ctx *fiber.Ctx, err error, body []byte, meta LogMeta) {
|
||||
access := "-"
|
||||
reqURI := ctx.OriginalURL()
|
||||
path := strings.Split(ctx.Path(), "/")
|
||||
bucket, object := path[1], strings.Join(path[2:], "/")
|
||||
var bucket, object string
|
||||
if len(path) > 1 {
|
||||
bucket, object = path[1], strings.Join(path[2:], "/")
|
||||
}
|
||||
errorCode := ""
|
||||
httpStatus := 200
|
||||
startTime := ctx.Locals("startTime").(time.Time)
|
||||
|
||||
@@ -65,7 +65,10 @@ func (wl *WebhookLogger) Log(ctx *fiber.Ctx, err error, body []byte, meta LogMet
|
||||
access := "-"
|
||||
reqURI := ctx.OriginalURL()
|
||||
path := strings.Split(ctx.Path(), "/")
|
||||
bucket, object := path[1], strings.Join(path[2:], "/")
|
||||
var bucket, object string
|
||||
if len(path) > 1 {
|
||||
bucket, object = path[1], strings.Join(path[2:], "/")
|
||||
}
|
||||
errorCode := ""
|
||||
httpStatus := 200
|
||||
startTime := ctx.Locals("startTime").(time.Time)
|
||||
|
||||
Reference in New Issue
Block a user