tgdrive / teldrive

Telegram Drive
MIT License
1.8k stars 266 forks source link

index out of range error when trying to download files over 200GB (files having more than >200 parts) #240

Closed steffen-poulsen closed 5 months ago

steffen-poulsen commented 5 months ago

For fun I am trying to test the max file size that teldrive can handle, and I encountered this error.

Uploading works fine.


{
   "level":"error",
   "ts":"2024-05-31T10:41:16.186Z",
   "msg":"[Recovery from panic]",
   "time":"2024-05-31T10:41:16.184Z",
   "error":"runtime error: index out of range [200] with length 200",
   "request":"GET /api/files/<redacted>/stream/<redacted>.tar?hash=<redacted>&d=1 HTTP/1.1\r
Host: <redacted>:8080\r
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\r
Accept-Encoding: gzip, deflate\r
Accept-Language: en-US,en;q=0.5\r
Connection: keep-alive\r
Cookie: user-session=<redacted>
Priority: u=1\r
Referer: <redacted>
Upgrade-Insecure-Requests: 1\r
User-Agent: <redacted>
\r
",
   "stack":"goroutine 18272597 [running]:
runtime/debug.Stack()
\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e
github.com/divyam234/teldrive/api.InitRouter.RecoveryWithZap.CustomRecoveryWithZap.func2.1()
\t/go/pkg/mod/github.com/gin-contrib/zap@v0.2.0/zap.go:147 +0x330
panic({0x17fd0e0?, 0xc00138a300?})
\t/usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/divyam234/teldrive/pkg/services.rangedParts({0xc0013b4000?, 0xc00204e300?, 0x1e30f38?}, 0xc001418180?, 0xc00005ade0?)
\t/app/pkg/services/common.go:214 +0x536
github.com/divyam234/teldrive/pkg/services.(*FileService).GetFileStream(0xc000ef81c8, 0xc00204e300)
\t/app/pkg/services/file.go:624 +0x19b1
github.com/divyam234/teldrive/pkg/controller.(*Controller).GetFileStream(...)
\t/app/pkg/controller/file.go:101
github.com/gin-gonic/gin.(*Context).Next(0xc00204e300)
\t/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
github.com/divyam234/teldrive/api.InitRouter.RecoveryWithZap.CustomRecoveryWithZap.func2(0xc001257488?)
\t/go/pkg/mod/github.com/gin-contrib/zap@v0.2.0/zap.go:159 +0x78
github.com/gin-gonic/gin.(*Context).Next(0xc00204e300)
\t/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
github.com/divyam234/teldrive/api.InitRouter.Ginzap.GinzapWithConfig.func1(0xc00204e300)
\t/go/pkg/mod/github.com/gin-contrib/zap@v0.2.0/zap.go:59 +0xb1
github.com/gin-gonic/gin.(*Context).Next(...)
\t/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc000483520, 0xc00204e300)
\t/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 +0x65b
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc000483520, {0x1e46ae0?, 0xc0001300e0}, 0xc00204e200)
\t/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 +0x1dd
net/http.serverHandler.ServeHTTP({0xc001f534a0?}, {0x1e46ae0?, 0xc0001300e0?}, 0x6?)
\t/usr/local/go/src/net/http/server.go:2938 +0x8e
net/http.(*conn).serve(0xc001bb4f30, {0x1e488e8, 0xc0001f6c00})
\t/usr/local/go/src/net/http/server.go:2009 +0x5f4
created by net/http.(*Server).Serve in goroutine 1
\t/usr/local/go/src/net/http/server.go:3086 +0x5cb
"
}
divyam234 commented 5 months ago

@steffen-poulsen this one was fixed in latest version

steffen-poulsen commented 5 months ago

Oh, sounds good! :-)

I'm just running off the main branch, the gui states the version as:

Build: 1.0.22-8b7c322

How do I get to the latest version, I wonder - I still have the error?

# docker-compose --verbose pull
[+] Running 1/1
 ⠿ server Pulled
steffen-poulsen commented 5 months ago

Ah, just needed a git pull also it seems. I'll be back :-)

steffen-poulsen commented 5 months ago

Much better now, downloads are now fine - thanks! :-)

steffen-poulsen commented 5 months ago

Closing this.