From d2f025cbead7269113a84ae9fce4a78771f47b70 Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Wed, 17 Jan 2024 17:46:15 +0800 Subject: [PATCH] Update writer.go --- internal/file/writer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/file/writer.go b/internal/file/writer.go index 457b454..233e493 100644 --- a/internal/file/writer.go +++ b/internal/file/writer.go @@ -63,6 +63,11 @@ func (c *creator) NewWriter(id, total int64, name, subPath string, format Format // Ref: https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words filename = escape(filename) + // Avoid filename too large. + if len(filename) > 200 { + filename = filename[:200] + } + // Create the download path. downloadPath := c.downloadPath if subPath != "" {