Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error ErrNotFile returned when extracting metadata from folder #55

Merged
merged 2 commits into from
Apr 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions exiftool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"io"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"testing"
Expand Down Expand Up @@ -617,24 +616,11 @@ func copyFile(src, dest string) (err error) {
}

func TestFailOnDirectoryInput(t *testing.T) {
// https://github.com/barasher/go-exiftool/issues/52
e, err := NewExiftool()
require.Nil(t, err)
defer e.Close()

// create test directory with about 200MB worth of photos
// 10,000 of the included jpg or 6 30MB CR2's both repro
tmpPath := t.TempDir()
for i := 0; i < 10_000; i++ {
err := copyFile("./testdata/20190404_131804.jpg", path.Join(tmpPath, fmt.Sprintf("%d.jpg", i)))
require.NoError(t, err)
}

fms := e.ExtractMetadata(tmpPath)
assert.Len(t, fms, 1)
assert.Equal(t, ErrNotFile, fms[0].Err)

fms = e.ExtractMetadata("./testdata/20190404_131804.jpg")
fms := e.ExtractMetadata("./testdata")
barasher marked this conversation as resolved.
Show resolved Hide resolved
assert.Len(t, fms, 1)
assert.Nil(t, fms[0].Err)
assert.NotNil(t, fms[0].Err)
barasher marked this conversation as resolved.
Show resolved Hide resolved
}