tdf#164686: handle exceptions from UCBContentHelper::Exists
When a filename can be treated as a non-file URL, checking its existence may throw. This needs to be handled here. Handles '?' in the filename. Change-Id: If065c483d1a44cbbfcea21f91d72adf1fdfde579 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180199 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -833,7 +833,18 @@ void SvtFileDialog::OpenHdl_Impl(void const * pVoid)
|
|||||||
{
|
{
|
||||||
case FILEDLG_MODE_SAVE:
|
case FILEDLG_MODE_SAVE:
|
||||||
{
|
{
|
||||||
if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ) )
|
bool exists;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
exists = utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
||||||
|
}
|
||||||
|
catch (const Exception&)
|
||||||
|
{
|
||||||
|
DBG_UNHANDLED_EXCEPTION("fpicker.office");
|
||||||
|
ErrorHandler::HandleError(ERRCODE_IO_GENERAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (exists)
|
||||||
{
|
{
|
||||||
OUString aMsg = FpsResId(STR_SVT_ALREADYEXISTOVERWRITE);
|
OUString aMsg = FpsResId(STR_SVT_ALREADYEXISTOVERWRITE);
|
||||||
aMsg = aMsg.replaceFirst(
|
aMsg = aMsg.replaceFirst(
|
||||||
|
Reference in New Issue
Block a user