diff --git a/pkg/channels/line.go b/pkg/channels/line.go index 009be68a1..52f78f2f8 100644 --- a/pkg/channels/line.go +++ b/pkg/channels/line.go @@ -317,19 +317,19 @@ func (c *LINEChannel) processEvent(event lineEvent) { case "image": localPath := c.downloadContent(msg.ID, "image.jpg") if localPath != "" { - mediaPaths = append(mediaPaths, localPath) + mediaPaths = append(mediaPaths, localPath) content = "[image]" } case "audio": localPath := c.downloadContent(msg.ID, "audio.m4a") if localPath != "" { - mediaPaths = append(mediaPaths, localPath) + mediaPaths = append(mediaPaths, localPath) content = "[audio]" } case "video": localPath := c.downloadContent(msg.ID, "video.mp4") if localPath != "" { - mediaPaths = append(mediaPaths, localPath) + mediaPaths = append(mediaPaths, localPath) content = "[video]" } case "file": diff --git a/pkg/channels/slack.go b/pkg/channels/slack.go index d3e400e24..d23e71080 100644 --- a/pkg/channels/slack.go +++ b/pkg/channels/slack.go @@ -238,7 +238,7 @@ func (c *SlackChannel) handleMessageEvent(ev *slackevents.MessageEvent) { if localPath == "" { continue } - mediaPaths = append(mediaPaths, localPath) + mediaPaths = append(mediaPaths, localPath) if utils.IsAudioFile(file.Name, file.Mimetype) && c.transcriber != nil && c.transcriber.IsAvailable() { ctx, cancel := context.WithTimeout(c.ctx, 30*time.Second) diff --git a/pkg/channels/telegram.go b/pkg/channels/telegram.go index 8681f7295..9e34a6a9d 100644 --- a/pkg/channels/telegram.go +++ b/pkg/channels/telegram.go @@ -237,7 +237,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes photo := message.Photo[len(message.Photo)-1] photoPath := c.downloadPhoto(ctx, photo.FileID) if photoPath != "" { - mediaPaths = append(mediaPaths, photoPath) + mediaPaths = append(mediaPaths, photoPath) if content != "" { content += "\n" } @@ -248,7 +248,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes if message.Voice != nil { voicePath := c.downloadFile(ctx, message.Voice.FileID, ".ogg") if voicePath != "" { - mediaPaths = append(mediaPaths, voicePath) + mediaPaths = append(mediaPaths, voicePath) transcribedText := "" if c.transcriber != nil && c.transcriber.IsAvailable() { @@ -282,7 +282,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes if message.Audio != nil { audioPath := c.downloadFile(ctx, message.Audio.FileID, ".mp3") if audioPath != "" { - mediaPaths = append(mediaPaths, audioPath) + mediaPaths = append(mediaPaths, audioPath) if content != "" { content += "\n" } @@ -293,7 +293,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes if message.Document != nil { docPath := c.downloadFile(ctx, message.Document.FileID, "") if docPath != "" { - mediaPaths = append(mediaPaths, docPath) + mediaPaths = append(mediaPaths, docPath) if content != "" { content += "\n" } diff --git a/pkg/utils/media_test.go b/pkg/utils/media_test.go index 05f99a4b1..e77908056 100644 --- a/pkg/utils/media_test.go +++ b/pkg/utils/media_test.go @@ -10,13 +10,13 @@ import ( func TestMediaCleanerRemovesOldFiles(t *testing.T) { // Setup: create a temp media directory with old and new files mediaDir := filepath.Join(os.TempDir(), MediaDir) - if err := os.MkdirAll(mediaDir, 0700); err != nil { + if err := os.MkdirAll(mediaDir, 0o700); err != nil { t.Fatalf("failed to create media dir: %v", err) } // Create an "old" file and backdate its modification time oldFile := filepath.Join(mediaDir, "test_old_file.jpg") - if err := os.WriteFile(oldFile, []byte("old"), 0600); err != nil { + if err := os.WriteFile(oldFile, []byte("old"), 0o600); err != nil { t.Fatalf("failed to create old file: %v", err) } oldTime := time.Now().Add(-1 * time.Hour) @@ -26,7 +26,7 @@ func TestMediaCleanerRemovesOldFiles(t *testing.T) { // Create a "new" file (just created, so modtime is now) newFile := filepath.Join(mediaDir, "test_new_file.jpg") - if err := os.WriteFile(newFile, []byte("new"), 0600); err != nil { + if err := os.WriteFile(newFile, []byte("new"), 0o600); err != nil { t.Fatalf("failed to create new file: %v", err) }