iyear / tdl

📥 A Telegram toolkit written in Golang
https://docs.iyear.me/tdl
GNU Affero General Public License v3.0
4.24k stars 431 forks source link

fix(recovery):panic serving interface conversion #644

Closed user1121114685 closed 3 months ago

user1121114685 commented 3 months ago

2024/06/12 22:27:36 http: panic serving [::1]:3062: interface conversion: interface {} is nil, not *zap.Logger goroutine 77 [running]: net/http.(*conn).serve.func1() net/http/server.go:1868 +0xb9 panic({0x20f3be0?, 0xc0005286f0?}) runtime/panic.go:920 +0x270 github.com/iyear/tdl/pkg/logger.From(...) github.com/iyear/tdl/pkg/logger/logger.go:14 github.com/iyear/tdl/pkg/recovery.(*recovery).Handle.func1({0x2695ce8, 0xc00004a9c0}, {0x26897c0?, 0xc0005286c0}, {0x26897e0?, 0xc000476680}) github.com/iyear/tdl/pkg/recovery/recovery.go:32 +0x189 github.com/gotd/td/telegram.InvokeFunc.Invoke(0x30?, {0x2695ce8?, 0xc00004a9c0?}, {0x26897c0?, 0xc0005286c0?}, {0x26897e0?, 0xc000476680?}) github.com/gotd/td@v0.102.0/telegram/middleware.go:15 +0x47 github.com/gotd/td/tg.(*Client).UploadGetFile(0xc000476380, {0x2695ce8, 0xc00004a9c0}, 0x34063ac?) github.com/gotd/td@v0.102.0/tg/tl_upload_get_file_gen.go:341 +0x70 github.com/gotd/contrib/tg_io.chunkSource.Chunk({{0x26a6558?, 0xc0000bf380?}, 0xc000476380?, 0x0?}, {0x2695ce8, 0xc00004a9c0}, 0x0, {0xc0006e2000, 0x80000, 0x80000}) github.com/gotd/contrib@v0.20.0/tg_io/download.go:51 +0xd2 github.com/gotd/contrib/partio.Streamer.safeRead({0x2695ce8?, {0x2688740?, 0xc00025a340?}}, {0x2695ce8?, 0xc00004a9c0?}, 0xc19289f61a265e98?, {0xc0006e2000?, 0x80000, 0x1a53dcd59?}) github.com/gotd/contrib@v0.20.0/partio/streamer.go:37 +0x54

当运行 .\tdl.exe dl -u https://t.me/xxxx/xxxx --serve 的时候访问链接出现崩溃。此pr 可以修复这个崩溃