tgdrive / teldrive

Telegram Drive
MIT License
1.81k stars 269 forks source link

[Bug]: possible data loss #378

Closed D0nnieD4rk0 closed 3 weeks ago

D0nnieD4rk0 commented 3 weeks ago

Describe the bug

i tried opening an html file i had stored on here only for teldrive to crash with error code:

22/10/2024 05:09 PM     INFO    /api/files      {"status": 200, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Fkiwi+bookmarks&sort=id", "ip": "::1", "user-agent": "rclone/v1.68.0", "latency": 0.1124755, "time": "2024-10-22T14:09:35Z"}
panic: interface conversion: tg.MessageClass is *tg.MessageEmpty, not *tg.Message

goroutine 165 [running]:
github.com/tgdrive/teldrive/pkg/services.getParts({0x2615390, 0xc000253300}, 0xc000256008, {0x2612a50, 0xc00017e270}, 0xc000ebfb08)
        github.com/tgdrive/teldrive/pkg/services/common.go:43 +0x552
github.com/tgdrive/teldrive/pkg/services.(*FileService).GetFileStream.func1()
        github.com/tgdrive/teldrive/pkg/services/file.go:852 +0xa9
github.com/tgdrive/teldrive/pkg/services.(*FileService).GetFileStream.func2({0x2615120?, 0xc000231b80?})
        github.com/tgdrive/teldrive/pkg/services/file.go:874 +0x13
github.com/tgdrive/teldrive/pkg/services.(*FileService).GetFileStream.RunWithAuth.func3({0x2615120, 0xc000231b80})
        github.com/tgdrive/teldrive/internal/tgc/run.go:40 +0x503
github.com/gotd/td/telegram.(*Client).Run.func3({0x2615120, 0xc000231b80})
        github.com/gotd/td@v0.111.0/telegram/connect.go:150 +0xb7
github.com/gotd/td/telegram.(*Client).Run.(*CancellableGroup).Go.func6()
        github.com/gotd/td@v0.111.0/tdsync/cancel_group.go:48 +0x23
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 112
        golang.org/x/sync@v0.8.0/errgroup/errgroup.go:75 +0x96

tried downloading and copying with rclone but those failed too and crashed teldrive

it is an older file i had stored when teldrive still worked with NeonDB (Neon was the recommended db back in the day), but if this project is meant for cloud storage then data randomly disappearing is concerning

Repoduction

try to open an html file teldrive crashes

Expected behavior

file opens

Version

teldrive 1.5.3

Which Platform are you using?

Windows

Additional context

No response

divyam234 commented 3 weeks ago

https://gist.github.com/danieleg1/1427c2a535b4dd4a6775e0fa82431400

Run this script to fix this

D0nnieD4rk0 commented 2 weeks ago

https://gist.github.com/danieleg1/1427c2a535b4dd4a6775e0fa82431400

Run this script to fix this

@divyam234 well all that did was delete the files from teldrive and running cleandb -t -e does't work. bruh i lost data i hadnt backed up elsewhere. go ahead and a warning to your README at least that this might happen