Bug 106788 - Libreoffice kde4 file save dialog allows newline characters in file name
Summary: Libreoffice kde4 file save dialog allows newline characters in file name
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Not Assigned
Keywords: bibisectRequest, regression
Depends on:
Blocks: PDF-Export-File-Dialog
  Show dependency treegraph
Reported: 2017-03-27 01:25 UTC by Alan
Modified: 2019-01-10 18:34 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:

Example of file name using the ls command (222 bytes, text/plain)
2017-03-27 01:26 UTC, Alan
A sample of where I get the file from (9.34 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-03-27 01:27 UTC, Alan
Example of a file with a newline character (21.10 KB, application/pdf)
2017-03-27 01:27 UTC, Alan

Note You need to log in before you can comment on or make changes to this bug.
Description Alan 2017-03-27 01:25:05 UTC
As part of my work I need to generate pdf documents where I copy and paste the data into a Writer document then export as a pdf. Part of the name I need to save the file as comes from cells in tables or a spreadsheet. It appears that every cell has a newline character (hex 0A) at the end of the text. The newline character is included when copying the text (which I assume is intended). The newline character is transparently included when pasting the copied text in the Name field of the Export dialog. This causes problems when the file is further processed in my workflow.
Please filter out the newline character in the file save dialog or give an option to do so.

Steps to Reproduce:
1.Copy the cell Name in the attached sample.ods
2.Export as PDF
3.Paste the copied name in the save file dialog and type something after it
4.File name is saved with the newline (hex 0A) character

Actual Results:  
A new line character is included in the file name. 

Expected Results:
The Export dialog should filter out all newline characters before saving the file.

Reproducible: Always

User Profile Reset: No

Additional Info:
Running Kubuntu 16.10
  Plasma 5.8.5
  KDE Frameworks 5.6.1
  kernel 4.8.0-37-generic, 64 bit
  Okular version 0.25.0
  Build ID: 1:5.2.2-0ubuntu2
  CPU Threads: 8; OS Version: Linux 4.8; UI Render: default

See ls-1.txt for bash file listing
See sample.ods for a sample of where I get the file names from
See 'Person, One NewYork.pdf' as an example of what happens to the file name.

More information upon request

User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Alan 2017-03-27 01:26:15 UTC
Created attachment 132161 [details]
Example of file name using the ls command
Comment 2 Alan 2017-03-27 01:27:01 UTC
Created attachment 132162 [details]
A sample of where I get the file from
Comment 3 Alan 2017-03-27 01:27:35 UTC
Created attachment 132163 [details]
Example of a file with a newline character
Comment 4 Xisco Faulí 2017-03-27 09:38:51 UTC
Hello Alan,

it seems you're using an old version of LibreOffice.
Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.
Comment 5 Alan 2017-03-29 17:56:10 UTC
Same behavior with 
  Build ID: 1:5.3.1-0ubuntu1~yakkety0
  CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; Layout Engine: new;
Comment 6 QA Administrators 2018-01-02 10:15:34 UTC Comment hidden (obsolete)
Comment 7 Alan 2018-01-09 20:15:03 UTC
Bug is still present in the latest version.
Comment 8 Buovjaga 2018-01-30 18:26:43 UTC
I repro, but not with 3.6

Arch Linux 64-bit
Build ID: 73c757ff71b6bf14206adf13a65213c79928a592
CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group threaded
Built on January 30th 2018

Arch Linux 64-bit
Version (Build ID: e183d5b)
Comment 9 Alan 2018-02-20 20:01:16 UTC
Bug is still present in LibreOffice 
(Build ID: 1:6.0.1~rc1-0ubuntu0.17.10.1~lo1)
It appears to be a bug in the save dialog since the same behavior happens when I 'save as' too.
Comment 10 Buovjaga 2018-07-12 15:46:50 UTC
Not yet in latest commit of Linux 50max bibisect repo.
Comment 11 Caolán McNamara 2019-01-10 17:33:21 UTC
As far as I can see, the gen, gtk and gtk3 file dialog behave as it they strip that trailing newline when pasted into and when adding some follow up text there is no embedded newline in the result. I imagine its more chance than design and the newlines are stripped out by their text entry widgets.

The kde4 one however, checking fedora 29 builds, indeed doesn't strip it. The kde4 integration used KFileDialog and how it managed getting pasted into isn't under LibreOffice's direct control though.

Note: The kde4 integration in LibreOffice is now gone from master in favour of the kde5 one. kde5 is using QFileDialog and I don't know if that make any different for the future, though I imagine that if there is still an issue in kde5 that it likewise is outside the scope of LibreOffice itself.
Comment 12 Buovjaga 2019-01-10 18:34:53 UTC
It seems the kde5 save dialog does not behave like this.

Arch Linux 64-bit
Build ID: c2d59ec2832c8b51568e73e9314ab9c82f1f5b7b
CPU threads: 8; OS: Linux 4.20; UI render: default; VCL: kde5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 8 January 2019