Bug 148299 - Master document doesn't allow filename/path with consecutive spaces
Summary: Master document doesn't allow filename/path with consecutive spaces
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Stephan Bergmann
URL:
Whiteboard: target:7.4.0
Keywords:
Depends on:
Blocks: Writer-Master-Doc
  Show dependency treegraph
 
Reported: 2022-03-31 22:31 UTC by John
Modified: 2022-05-21 16:33 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John 2022-03-31 22:31:56 UTC
Description:
In a master document, links to subdocuments which have 2 or more spaces in the filename fail.


Windows 10 Pro 21H2
Libre Office 7.2.6.2 x64


Steps to Reproduce:
1. Create a new master doc.
2. Create or link to a subdocument.
3. If the subdocument has 2 spaces in the filename, the filename can't be found.

My Filename.odt  --> OK
My  Filname.odt  --> Not Found

Actual Results:
Filename not found

Expected Results:
Linked subdocument file


Reproducible: Always


User Profile Reset: No



Additional Info:
It appears the 'convert to URL' step fails as the file path displays with spaces instead of '%20'.  

From the navigator, right click the bad file > edit link.

Manually adding %20 into the link path fails.

When checking the file link from within the master document, the link path has only one space.  Manually adding a 2nd space doesn't work (after re-opening the dialog, the path shows with only 1 space).  It appears that file path whitespace of any length is being reduced to a single space.
Comment 1 Dieter 2022-04-15 11:48:38 UTC
Tested with

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: d34d1db55978bdcff082af1e0f75b18fa6fc94f4
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Actual result
Filename is displayed in red and no content is added to master document. (John, I hope this is equal to your result "Filename not found"

But what is your expected result
a) LO should find files with more than one space in filename (any limits?)
b) There should be an explanation, why filename becomes red
c) ...

Personally I think, file names with two or more consecutive spaces should not be used and so i won't expect LO to find them.
Comment 2 John 2022-04-15 21:40:16 UTC
Hi Dieter, appreciate you looking into this!

For context I was writing specifications, with file names following a standard format "## ## ## - Title".  Occasionally I'd double-tap the space bar, or an extra space would sneak in there while renaming.  

The extra space is nearly invisible, so it just appeared to me like the file was randomly corrupted.  It wasn't until I was looking at the files in windows explorer that my OCD compelled me to figure out why some of the file names weren't kerning properly, that I found the root cause.  Multiple spaces in the filename is not at all a requirement, just a nearly-invisible accident.

Long story short:  a more descriptive error would be a fine solution.

Cheers!
Comment 3 QA Administrators 2022-04-16 03:52:25 UTC Comment hidden (obsolete)
Comment 4 Dieter 2022-05-03 11:09:01 UTC
(In reply to John from comment #2)
> Long story short:  a more descriptive error would be a fine solution.

O. K., let's take this as enhancement request and ask design-team for further input and decision.

cc: Design-Team

Steps to reproduce:
1. Create a new master doc
2. Create or link to a subdocument with 2 spaces in filename

Actual result
Filename is displayed in red and no content is added to master document. (John, I hope this is equal to your result "Filename not found"

Enhancement request
Instead of the current result it would be better to give an error message to the user like "Path of selected file is invalid, because it contains two censecutive spaces."
Comment 5 Heiko Tietze 2022-05-04 09:50:29 UTC
Posix recommends to use only A..Z, a..z, numbers, hyphen and underscore. But space are not forbidden. If the file system allows the name we should not mess with it.
Comment 6 Dieter 2022-05-04 09:55:40 UTC
(In reply to Heiko Tietze from comment #5)
> Posix recommends to use only A..Z, a..z, numbers, hyphen and underscore. But
> space are not forbidden. If the file system allows the name we should not
> mess with it.

Just for clarification: So bug summary would be something like "Master document doesn't allow filename/path with consecutive spaces", correct?
Comment 7 Heiko Tietze 2022-05-04 10:11:04 UTC
Yes, we should allow multiple spaces. No warning is needed.
Comment 8 Commit Notification 2022-05-05 06:29:07 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d7fbea57ef945c1444185581787d17a93dda8cd9

tdf#148299 Don't unmotivatedly mess with spaces in file names

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Dieter 2022-05-21 16:33:22 UTC
VERIFIED with

Version: 7.4.0.0.alpha1 (x64) / LibreOffice Community
Build ID: b871abad383583f02eb49c7e49aeae01f6941072
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Stephan, thanks for fixing it!