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

Commit 481ad13

Browse files
sbeaufortjacobmarble
authored andcommitted
Fix of issue 340 : Failed to submit to native print system with some 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
1 parent d353d01 commit 481ad13

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cups/translate-ticket.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ func translateTicket(printer *lib.Printer, ticket *cdd.CloudJobTicket) (map[stri
3131
m := map[string]string{}
3232
for _, vti := range ticket.Print.VendorTicketItem {
3333
if vti.ID == ricohPasswordVendorID {
34+
if vti.Value == "" {
35+
// do not add specific map of options for Ricoh vendor like ppdLockedPrintPassword or ppdJobType when password is empty
36+
continue;
37+
}
3438
if !rRicohPasswordFormat.MatchString(vti.Value) {
35-
return map[string]string{}, errors.New("Invalid password format")
39+
return map[string]string{}, errors.New("Invalid password format")
3640
}
3741
}
3842

cups/translate-ticket_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ func TestTranslateTicket_RicohLockedPrint(t *testing.T) {
281281
}
282282
expected = map[string]string{}
283283
o, err = translateTicket(&printer, &ticket)
284-
if err == nil {
285-
t.Log("expected error")
284+
if err != nil {
285+
t.Logf("did not expect error %s", err)
286286
t.Fail()
287-
}
287+
}
288288
if !reflect.DeepEqual(o, expected) {
289289
t.Logf("expected\n %+v\ngot\n %+v", expected, o)
290290
t.Fail()

0 commit comments

Comments
 (0)