Bug 155025 - Consider LocalAppData folder on Windows as "temporary", and do not offer saving into it
Summary: Consider LocalAppData folder on Windows as "temporary", and do not offer savi...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp, skillWindows
Depends on:
Blocks:
 
Reported: 2023-04-26 07:29 UTC by Mike Kaganski
Modified: 2023-05-10 13:32 UTC (History)
1 user (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 Mike Kaganski 2023-04-26 07:29:39 UTC
There is a recurring problem that people keep documents that they open from, say, Windows Mail, right where these documents were put by the mailer application. See bug 117578; also questions on Ask like https://ask.libreoffice.org/t/why-were-files-saved-to-a-temporary-folder/33820 and https://ask.libreoffice.org/t/my-files-will-not-open-in-libre-office-writer/90897.

Even when the temporary file had been marked read-only by the generating application (which seems to happen in Windows Mail, based on my local testing), using Save As suggests the same directory (like "C:\Users\user\AppData\Local\Packages\microsoft.windowscommunicationsapps_8wekyb3d8bbwe\LocalState\Files\S0\67445\Attachments"), and a careless user could just rename and save there, which would later lead to disaster, when the application that manages that temporary directory decides to clean it up.

A similar problem was tracked in bug 80807 and bug 109537. The solution was to make sure not to suggest the same location, when it's known that it's in a temporary path.

The proposal and the easy hack here is to treat Windows' LocalAppData folder as a whole as such a temporary location, because its purpose is described to be for "program settings, IE cookies, IE browsing history, temporary files created by applications"; and do not offer to save into it, when showing the Save As dialog.

The code pointer is the commit fixing bug 109537 in the same way as suggested here.