After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705848 - filename proposed for printing uses '%20' in place of spaces
filename proposed for printing uses '%20' in place of spaces
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: printing
git master
Other Linux
: Normal normal
: ---
Assigned To: Sindhu S
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-12 14:25 UTC by Adam Dingle
Modified: 2013-08-21 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of Evince proposing default name for Print to File option (122.15 KB, image/png)
2013-08-18 14:23 UTC, Sindhu S
  Details
Patch for unescaping the filename for print-to-file (882 bytes, patch)
2013-08-18 18:50 UTC, aakash
needs-work Details | Review
Updated patch for unescaping the filename for print-to-file (1.25 KB, patch)
2013-08-19 00:48 UTC, aakash
committed Details | Review

Description Adam Dingle 2013-08-12 14:25:40 UTC
To see the problem:

1. Open a PDF file whose name contains spaces, e.g. 'one two three.pdf'.
2. Choose File->Print.
3. Select "Print to File".

Evince will propose the filename $HOME/Documents/one%20two%20three.pdf.  The spaces have been replaced by '%20'.  This is distracting and unhelpful.
Comment 1 Sindhu S 2013-08-18 14:23:50 UTC
Created attachment 252125 [details]
Screenshot of Evince proposing default name for Print to File option

Hi, Adam

I compiled evince from git master and tried to reproduce the issue but I could not. Evince proposes the default name for a file (through the Print to File option) as "output".

Could you please confirm if you are still seeing this bug after compiling from git master? Thanks.
Comment 2 Adam Dingle 2013-08-18 18:08:22 UTC
Sindhu, I still see this bug even after compiling Evince from git master.  I'm running on Ubuntu 13.10 with GTK 3.9.10 and GLib 2.37.5.  Not sure why we're seeing different behavior here.
Comment 3 aakash 2013-08-18 18:50:29 UTC
Created attachment 252151 [details] [review]
Patch for unescaping the filename for print-to-file

Hi, I am being able to reproduce this bug, and I can trace it back to a commit a5e2a06 - "ev-window: set output basename for print to file".

The commit helped in getting the actual filename there instead of 'output.pdf' which Sindhu is getting. However, we need to unescape the string as it uses the document's uri. I have attached a patch for the same.
Comment 4 Germán Poo-Caamaño 2013-08-18 23:46:39 UTC
Review of attachment 252151 [details] [review]:

This solves the issue.  Although, you must free the string returned g_uri_unescape_string() when is not longer needed. Otherwise, you will be leaking memory.

You might want to use something like:

char       *unescaped_uri;

[...]
unescaped_uri = g_uri_unescape_string (output_basename, NULL);

gtk_print_settings_set (print_settings,
                        GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
                        unescaped_uri);
g_free (unescaped_uri);
Comment 5 aakash 2013-08-19 00:48:49 UTC
Created attachment 252170 [details] [review]
Updated patch for unescaping the filename for print-to-file

Hi gpoo, thanks for the quick review! I have updated the patch to accommodate your suggestion. I hope its better now.

Thank you once again.
Comment 6 Germán Poo-Caamaño 2013-08-19 20:30:54 UTC
Review of attachment 252170 [details] [review]:

The patch looks good to me. Let's see what Carlos says.
Comment 7 Carlos Garcia Campos 2013-08-21 15:11:45 UTC
Comment on attachment 252170 [details] [review]
Updated patch for unescaping the filename for print-to-file

Pushed to git master, thanks.