diff --git a/cups/translate-ticket.go b/cups/translate-ticket.go index 2e96b3b..8e37e08 100644 --- a/cups/translate-ticket.go +++ b/cups/translate-ticket.go @@ -31,8 +31,12 @@ func translateTicket(printer *lib.Printer, ticket *cdd.CloudJobTicket) (map[stri m := map[string]string{} for _, vti := range ticket.Print.VendorTicketItem { if vti.ID == ricohPasswordVendorID { + if vti.Value == "" { + // do not add specific map of options for Ricoh vendor like ppdLockedPrintPassword or ppdJobType when password is empty + continue; + } if !rRicohPasswordFormat.MatchString(vti.Value) { - return map[string]string{}, errors.New("Invalid password format") + return map[string]string{}, errors.New("Invalid password format") } } diff --git a/cups/translate-ticket_test.go b/cups/translate-ticket_test.go index aeac954..a9741db 100644 --- a/cups/translate-ticket_test.go +++ b/cups/translate-ticket_test.go @@ -281,10 +281,10 @@ func TestTranslateTicket_RicohLockedPrint(t *testing.T) { } expected = map[string]string{} o, err = translateTicket(&printer, &ticket) - if err == nil { - t.Log("expected error") + if err != nil { + t.Logf("did not expect error %s", err) t.Fail() - } + } if !reflect.DeepEqual(o, expected) { t.Logf("expected\n %+v\ngot\n %+v", expected, o) t.Fail()