diff --git a/plugins/fileservices/fileservices.cpp b/plugins/fileservices/fileservices.cpp index 74f516b571e..d510691bd85 100644 --- a/plugins/fileservices/fileservices.cpp +++ b/plugins/fileservices/fileservices.cpp @@ -2837,22 +2837,24 @@ FILESERVICES_API void FILESERVICES_CALL fsDeleteExternalFile(ICodeContext * ctx CDfsLogicalFileName lfn; lfn.setExternal(location,path); + StringBuffer s("DeleteExternalFile ('"); RemoteFilename rfn; lfn.getExternalFilename(rfn); - Owned f = createIFile(rfn); - if (!f->exists()) - throw makeStringExceptionV(-1,"File %s not found",path); - if (f->isDirectory()==fileBool::foundYes) - checkExternalFileRights(ctx,lfn.get(),false,true); + Owned file = createIFile(rfn); + if (!file->exists()) + s.append(location).append(',').append(path).append("), file not found"); else { - StringBuffer scopes; - checkExternalFileRights(ctx,lfn.getScopes(scopes),false,true); + if (file->isDirectory()==fileBool::foundYes) + checkExternalFileRights(ctx,lfn.get(),false,true); + else + { + StringBuffer scopes; + checkExternalFileRights(ctx,lfn.getScopes(scopes),false,true); + } + file->remove(); + s.append(location).append(',').append(path).append(") done"); } - Owned file = createIFile(rfn); - file->remove(); - StringBuffer s("DeleteExternalFile ('"); - s.append(location).append(',').append(path).append(") done"); WUmessage(ctx,SeverityInformation,NULL,s.str()); AuditMessage(ctx,"DeleteExternalFile",path); }