Editing Name of printer accepts spaces but fails to actually change the printer name
The Printer Details dialog allows the user to input spaces in the Name field, but CUPS doesn't allow spaces in printer names so the name change fails. There is no indication to the user that the name is invalid. The dialog should prevent the user from entering invalid characters and/or warn the user if an invalid value is input.
Steps to reproduce:
-
Open GNOME Settings, Printers.
-
Click Unlock and enter your password to unlock the settings.
-
Click the gear icon next to an auto-detected printer or one that was previously added/configured.
-
Click Printer Details
-
Edit the Name field by e.g. adding some text at the beginning that contains spaces (e.g. "Use This " in front of "HP-Color-LaserJet-MFP-M477fdw".
-
Click the X to close the Printer Details dialog.
-
Notice the name hasn't changed.
-
This message appears in the journal:
Dec 27 18:46:22 u.lan gnome-control-c[3589]: cups-pk-helper: renaming of printer HP-Color-LaserJet-MFP-M477fdw failed: "Use This HP-Color-LaserJet-MFP-M477fdw" is not a valid printer name.
-
It works if you choose a name that doesn't contain spaces, e.g. "Use-This-HP-Color-LaserJet-MFP-M477fdw".
This is on Fedora 35 with gnome-control-center-41.2-1.fc35.x86_64.