Skip to content

Commit 9e50f46

Browse files
committed
fix: increase maximum device token length
1 parent 1e2ecf2 commit 9e50f46

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

route_push.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,6 @@ func push(params map[string]interface{}) (int, error) {
261261
return 400, fmt.Errorf("failed to get device token: %v", err)
262262
}
263263

264-
// Remove deviceToken if it’s too long, to clean up junk data.
265-
if len(deviceToken) > 128 {
266-
_ = db.DeleteDeviceByKey(msg.DeviceKey)
267-
return 400, fmt.Errorf("invalid device token, has been removed")
268-
}
269-
270264
msg.DeviceToken = deviceToken
271265

272266
code, err := apns.Push(&msg)

route_register.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func doRegister(c *fiber.Ctx, compat bool) error {
5151
}
5252

5353
// DeviceToken length is variable, but should not be too long.
54-
if len(deviceInfo.DeviceToken) > 128 {
54+
if len(deviceInfo.DeviceToken) > 160 {
5555
return c.Status(400).JSON(failed(400, "device token is invalid"))
5656
}
5757

0 commit comments

Comments
 (0)