Kaydet (Commit) 54c2e3c8 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Don't create temp file in save destination folder when sandboxed

In a sandboxed environment we don't want to attempt to create
temporary files in the same directory where the user has selected an
output file to be stored. The sandboxed process has permission only to
create the specifically named output file that the user chose in the
system file dialog in that directory.

Change-Id: I65274b4c433bd66b436429bea4b287a0505b72c9
üst 3afe0c79
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
...@@ -3506,6 +3506,11 @@ OUString GetLogicBase(std::unique_ptr<SfxMedium_Impl> const & pImpl) ...@@ -3506,6 +3506,11 @@ OUString GetLogicBase(std::unique_ptr<SfxMedium_Impl> const & pImpl)
{ {
OUString aLogicBase; OUString aLogicBase;
// In a sandboxed environment we don't want to attempt to create temporary files in the same
// directory where the user has selected an output file to be stored. The sandboxed process has
// permission only to create the specifically named output file in that directory.
#if !HAVE_FEATURE_MACOSX_SANDBOX
if (comphelper::isFileUrl(pImpl->m_aLogicName) && !pImpl->m_pInStream) if (comphelper::isFileUrl(pImpl->m_aLogicName) && !pImpl->m_pInStream)
{ {
// Try to create the temp file in the same directory when storing. // Try to create the temp file in the same directory when storing.
...@@ -3521,6 +3526,8 @@ OUString GetLogicBase(std::unique_ptr<SfxMedium_Impl> const & pImpl) ...@@ -3521,6 +3526,8 @@ OUString GetLogicBase(std::unique_ptr<SfxMedium_Impl> const & pImpl)
// Embedded objects would mean a special base, ignore that. // Embedded objects would mean a special base, ignore that.
aLogicBase.clear(); aLogicBase.clear();
#endif // !HAVE_FEATURE_MACOSX_SANDBOX
return aLogicBase; return aLogicBase;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment