@@ -21,7 +21,7 @@ import (
2121)
2222
2323const (
24− maxAttachmentSize = int64(5 * 1024 * 1024) // 5MB
24+ MaxAttachmentSize = int64(5 * 1024 * 1024) // 5MB
2525 FilePickerID = "filepicker"
2626 fileSelectionHight = 10
2727)
@@ -45,10 +45,12 @@ type model struct {
4545 help help.Model
4646}
4747
48+var AllowedTypes = []string{".jpg", ".jpeg", ".png"}
49+
4850func NewFilePickerCmp(workingDir string) FilePicker {
4951 t := styles.CurrentTheme()
5052 fp := filepicker.New()
51− fp.AllowedTypes = []string{".jpg", ".jpeg", ".png"}
53+ fp.AllowedTypes = AllowedTypes
5254
5355 if workingDir != "" {
5456 fp.CurrentDirectory = workingDir
@@ -127,7 +129,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
127129 return m, tea.Sequence(
128130 util.CmdHandler(dialogs.CloseDialogMsg{}),
129131 func() tea.Msg {
130− isFileLarge, err := ValidateFileSize(path, maxAttachmentSize)
132+ isFileLarge, err := IsFileTooBig(path, MaxAttachmentSize)
131133 if err != nil {
132134 return util.ReportError(fmt.Errorf("unable to read the image: %w", err))
133135 }
@@ -222,7 +224,7 @@ func (m *model) Position() (int, int) {
222224 return row, col
223225}
224226
225−func ValidateFileSize(filePath string, sizeLimit int64) (bool, error) {
227+func IsFileTooBig(filePath string, sizeLimit int64) (bool, error) {
226228 fileInfo, err := os.Stat(filePath)
227229 if err != nil {
228230 return false, fmt.Errorf("error getting file info: %w", err)