Bug 123474 - Cannot --convert-to using a drive root as --outdir on Windows
Summary: Cannot --convert-to using a drive root as --outdir on Windows
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:6.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-15 04:21 UTC by Mike Kaganski
Modified: 2019-02-15 10:12 UTC (History)
0 users

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 Mike Kaganski 2019-02-15 04:21:53 UTC
See https://ask.libreoffice.org/en/question/183177

Command line like

> path\to\soffice --convert-to pdf --outdir D:\ D:\dir\doc.odt

fails, and emits "Error: Please verify input parameters... (SfxBaseModel::impl_store <file:///D://doc.pdf> failed: 0x31c(Error Area:Io Class:NotExists Code:28))" in debug builds.

The problem is that IsValidFilePath(D:\\doc.pdf) returns false because of the two consequent backslashes after the drive letter (see check if dwCandidatPathType is PATHTYPE_ABSOLUTE_LOCAL). I don't know if it's correct (it looks like Windows command prompt has no problems with d:\\file.ext itself); however, to solve the problem, we can ensure that no extra slash is added when target directory already contains trailing slash (which is inevitable when it's a drive root, where omitting the trailing slash changes the meaning of the path to "current directory on that drive"). The place to change is at DispatchWatcher::executeDispatchRequests(), where currently URI is built like "aFilterOut + "/" + aOutFilename.getName()".

Tested with Version: 6.2.0.3 (x64)
Build ID: 98c6a8a1c6c7b144ce3cc729e34964b47ce25d62
CPU threads: 12; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded.
Comment 1 Mike Kaganski 2019-02-15 04:39:53 UTC
https://gerrit.libreoffice.org/67850
Comment 2 Commit Notification 2019-02-15 10:11:31 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/d9f9a9e56d558174cb5ff96c3bb78a5692a26570%5E%21

tdf#123474: use INetURLObject methods to construct valid URI

It will be available in 6.3.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.