summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-01-27 16:05:54 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-15 15:56:42 +0100
commitc2316601dfab8eaa4708e21f33427cb5e95e0bc1 (patch)
treef82e8f0e8e38dffd1e310c14fecdbe5d8ca86844 /sfx2
parent379ee97dd7a1f8cb33ed68c2d51aca13865c9c79 (diff)
tdf#123476 filter: Also handle empty ODF cp-6.2-29
This builds on top of commit ada07f303e7cd1e39c73abe0741aefe7d9d73a57, to allow 0-byte ODT, ODS etc. Possible TODO would be somehow use default template for such empty files, getting the template name using SfxObjectFactory::GetStandardTemplate. That would enable using 0-byte ODF files as means to "create new document at this location from default template" workflow. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109989 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 2854362f429e476d4a1ab4759c6a1f1c04150280) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110061 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Change-Id: I36e07b80f60c42aecdcc6a7357e5bdd18f62e4f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110938 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/objstor.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 50ec51f7e546..d8d0104ac315 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -438,7 +438,7 @@ bool SfxObjectShell::InitNew( const uno::Reference< embed::XStorage >& xStorage
bool SfxObjectShell::Load( SfxMedium& rMedium )
{
- return GeneralInit_Impl( rMedium.GetStorage(), true );
+ return GeneralInit_Impl(rMedium.GetStorage(), !tools::isEmptyFileUrl(rMedium.GetName()));
}
void SfxObjectShell::DoInitUnitTest()
@@ -674,7 +674,9 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
bWarnMediaTypeFallback = false;
}
- if ( bWarnMediaTypeFallback || !xStorage->getElementNames().getLength() )
+ if (bWarnMediaTypeFallback
+ || (!tools::isEmptyFileUrl(pMedium->GetName())
+ && !xStorage->getElementNames().getLength()))
SetError(ERRCODE_IO_BROKENPACKAGE);
}
catch( uno::Exception& )