diff --git a/internal/handlers/check.go b/internal/handlers/check.go index 02ff86a..f836450 100644 --- a/internal/handlers/check.go +++ b/internal/handlers/check.go @@ -88,6 +88,13 @@ func CheckMyWork(w http.ResponseWriter, r *http.Request) { } } + if column == "File Path" { + model := ColumnValue("Object Model", header, row) + if strInSlice(model, []string{"Binary", "Video", "Page", "Image", "Digital Document"}) { + errors[i] = "Missing source file" + } + } + continue } diff --git a/internal/handlers/check_test.go b/internal/handlers/check_test.go index 3a91a39..d46f93d 100644 --- a/internal/handlers/check_test.go +++ b/internal/handlers/check_test.go @@ -93,7 +93,7 @@ func TestCheckMyWork(t *testing.T) { response: `{"C2":"Missing value"}`, }, { - name: "Missing file", + name: "Non-existent file", method: http.MethodPost, body: [][]string{ {"Title", "Object Model", "Full Title", "File Path"}, @@ -102,6 +102,26 @@ func TestCheckMyWork(t *testing.T) { statusCode: http.StatusOK, response: `{"D2":"File does not exist in islandora_staging"}`, }, + { + name: "Missing file", + method: http.MethodPost, + body: [][]string{ + {"Title", "Object Model", "Full Title", "File Path"}, + {"foo", "Image", "foo", ""}, + }, + statusCode: http.StatusOK, + response: `{"D2":"Missing source file"}`, + }, + { + name: "Missing file OK", + method: http.MethodPost, + body: [][]string{ + {"Title", "Object Model", "Full Title", "File Path"}, + {"foo", "Paged Content", "foo", ""}, + }, + statusCode: http.StatusOK, + response: `{}`, + }, { name: "Missing supplemental file", method: http.MethodPost,