feat: Implement remaining tasks in Phase 1B and 1C

This commit is contained in:
2025-09-18 16:10:08 -07:00
parent 7ced3c908d
commit 47a179d215
5 changed files with 84 additions and 20 deletions

View File

@@ -100,7 +100,30 @@ func (c *Client) DownloadActivity(activityID int, opts activities.DownloadOption
outputPath = filepath.Join(opts.OutputDir, filename)
}
return c.Client.Download(fmt.Sprintf("%d", activityID), opts.Format, outputPath)
err := c.Client.Download(fmt.Sprintf("%d", activityID), opts.Format, outputPath)
if err != nil {
return err
}
// Basic validation: check if file is empty
fileInfo, err := os.Stat(outputPath)
if err != nil {
return &errors.IOError{
GarthError: errors.GarthError{
Message: "Failed to get file info after download",
Cause: err,
},
}
}
if fileInfo.Size() == 0 {
return &errors.IOError{
GarthError: errors.GarthError{
Message: "Downloaded file is empty",
},
}
}
return nil
}
// SearchActivities searches for activities by a query string