Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Fix of issue 340 : Failed to submit to native print system with some …
Browse files Browse the repository at this point in the history
…RICOH printer when password is empty (#341)

* Fix of issue 340 : Failed to submit to native print system with some RICOH printers when password is empty

* Fix of issue 340 : Failed to submit to native print system with some RICOH printers when password is empty
  • Loading branch information
sbeaufort authored and jacobmarble committed Jan 19, 2017
1 parent d353d01 commit 481ad13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cups/translate-ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
6 changes: 3 additions & 3 deletions cups/translate-ticket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 481ad13

Please sign in to comment.