cups icon indicating copy to clipboard operation
cups copied to clipboard

CUPS when adding a printer via the web interface gives an incorrect URI device

Open Gerben100 opened this issue 1 year ago • 1 comments

CUPS when adding a printer via the web interface gives an incorrect URI device

Steps:

  1. Connect the printer via USB to the PC;
  2. Menu -> System -> Printing settings (CUPS settings) -> Administration -> Add a printer -> Select the desired printer -> Continue.

Result: hieroglyphs in the "Connection" field. 1

Details:

  • does not depend on the browser and specific printer;
    • CUPS version 2.4.8 and higher

Expected result: correct display of characters.

A little analysis revealed that this commit f9927a4b08642dffc44cd41689ee70c171f34a39 breaks symbols.

The problem seems to be in this line

Replacing the cgiGetTextfield() function with cgiGetVariable() solves the problem, but is this a correct fix?

     }
   }

-  if ((var = cgiGetTextfield("DEVICE_URI")) != NULL)
+  if ((var = cgiGetVariable("DEVICE_URI")) != NULL)
   {
     if ((uriptr = strrchr(var, '|')) != NULL)
     {

Gerben100 avatar Jun 28 '24 18:06 Gerben100

Confirmed, will debug further to determine the best solution.

michaelrsweet avatar Jun 30 '24 17:06 michaelrsweet

@michaelrsweet any way I can help? It affects any discovered printer in CUPS Web UI (dnssd, socket, driverless, usb backends).

For others - workarounds are to use temporary queues (if possible), or install the printer via lpadmin (the proper uri gets discovered by lpinfo -l -v, which you can use in the lpadmin command).

zdohnal avatar Jul 23 '24 08:07 zdohnal

OK, so switching back to cgiGetVariable was the right approach, but there were two other places to change:

[master 4fa466735] Fix device URI when adding or modifying a printer (Issue #998)

[2.4.x 21a392d87] Fix device URI when adding or modifying a printer (Issue #998)

michaelrsweet avatar Aug 14 '24 00:08 michaelrsweet