The scheduler never gets the MIME type based on the document name for a single file job #3055

Closed
michaelrsweet opened this Issue Jan 9, 2009 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Jan 9, 2009

Version: 1.3-current
CUPS.org User: opher

Please look at scheduler/ipp.c line 7637:
doc_name = ippFindAttribute(con->request, "document-name", IPP_TAG_NAME);
filetype = mimeFileType(MimeDatabase, con->filename,
doc_name ? doc_name->values[0].string.text : NULL,
&compression);

The scheduler is looking for an attribute "document-name", BUT the client ONLY sends this attribute when printing more than one file per job:
in cups/util.c this attribute is sent in cupsPrintFiles2 ONLY when num_files > 1 .

Suggested patch attached.

Regards,
Opher Shachar.

Collaborator

michaelrsweet commented Jan 9, 2009

CUPS.org User: mike

Fixed in Subversion repository.

(This actually was already fixed by the API changes in CUPS 1.4)

Collaborator

michaelrsweet commented Jan 9, 2009

"document-name.patch":

This patch file was generated by NetBeans IDE

Following Index: paths are relative to: H:\My Documents\Projects\CUPS\cups-1.3.x\cups

This patch can be applied using context Tools: Patch action on respective folder.

It uses platform neutral UTF-8 encoding and \n newlines.

Above lines and this line are ignored by the patching process.

Index: util.c
--- util.c Base (BASE)
+++ util.c Locally Modified (Based On LOCAL)
@@ -1253,6 +1253,21 @@
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
title);

  • if (num_files == 1)
  • {
  • /*
    
  •  \* Add the original document filename...
    
  •  */
    
  •  if ((base = strrchr(files[0], '/')) != NULL)
    
  •    base ++;
    
  •  else
    
  •    base = files[0];
    
  •  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
    
  •               NULL, base);
    
  • }

/*

  • Then add all options...
    */
Collaborator

michaelrsweet commented Jan 9, 2009

"str3055.patch":

Index: cups/util.c

--- cups/util.c (revision 8218)
+++ cups/util.c (working copy)
@@ -1253,6 +1253,21 @@
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
title);

  • if (num_files == 1)
  • {
  • /*
  • * Add the original document filename...
  • */
  • if ((base = strrchr(files[0], '/')) != NULL)
  •  base ++;
    
  • else
  •  base = files[0];
    
  • ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
  •    NULL, base);
    
  • }

/*

  • Then add all options...
    */

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment