Bug 157450 - File is opened in read-only mode, when using an invalid file URL with backslashes on Windows
Summary: File is opened in read-only mode, when using an invalid file URL with backsla...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
(earliest affected)
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
Whiteboard: QA:needsComment
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
Reported: 2023-09-26 09:12 UTC by Mike Kaganski
Modified: 2023-10-25 03:14 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-09-26 09:12:56 UTC
Consider this BASIC code:

Sub UseInvalidURL
  StarDesktop.loadComponentFromURL("file:///D:\Documents\test.odt", "_blank", 0, Array())
End Sub

Given that you have such a file (D:\Documents\test.odt), this code would manage to open the file (even considering that the file URL is invalid, containing backslashes), but when opening, it will issue a warning that the lockfile couldn't be created, and offer to open it in read-only mode.

A consistent behavior could be one of:

* Either to disallow invalid URLs at all (so fail opening the document) - unlikely, given how widespread the use of such "URLs" is on Windows, where users simply concatenate "file:///" with the system path;
* Or if they are handled, then sanitize them, so that the rest of operations would work correctly, including lockfile generation.

Still, one valid outcome for this issue could be WONTFIX, based on GIGO principle. Stephan, what would you advise here - should it be fixed or not?