sw/source/filter/ww8/ww8par.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
New commits: commit 7c2d94c6b41a71e0440953d753f6a7092626bc9c Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Dec 17 11:50:02 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Dec 17 15:24:43 2024 +0100 crashtesting: unable to import rtf export of forum-mso-en-14843.doc user field names have control chars in them and import from rtf hits the code added by: commit a6516c76c01b92f7d35bfb352b63af7de42b5707 CommitDate: Wed Oct 30 14:44:09 2019 +0100 writerfilter: rtftok: filter control characters so control chars are stripped out, which results in a duplicate user field name which throws. Filtering out at doc import time seems to work better, so lets do that as well. Change-Id: I463e30b223bfb5639de23c696d112eda2c27b428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178657 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d2f67900b412..8d57a43297ca 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4835,7 +4835,7 @@ void SwWW8ImplReader::ReadDocVars() uno::Reference< container::XNameAccess > xFieldMasterAccess = xFieldsSupplier->getTextFieldMasters(); for(size_t i = 0; i < aDocVarStrings.size(); i++) { - const OUString &rName = aDocVarStrings[i]; + const OUString sName = sw::FilterControlChars(aDocVarStrings[i]); uno::Any aValue; if (aDocValueStrings.size() > i) { @@ -4847,7 +4847,7 @@ void SwWW8ImplReader::ReadDocVars() } uno::Reference< beans::XPropertySet > xMaster; - OUString sFieldMasterService("com.sun.star.text.FieldMaster.User." + rName); + OUString sFieldMasterService("com.sun.star.text.FieldMaster.User." + sName); // Find or create Field Master if (xFieldMasterAccess->hasByName(sFieldMasterService)) @@ -4857,7 +4857,7 @@ void SwWW8ImplReader::ReadDocVars() else { xMaster.set(xTextFactory->createInstance(u"com.sun.star.text.FieldMaster.User"_ustr), uno::UNO_QUERY_THROW); - xMaster->setPropertyValue(u"Name"_ustr, uno::Any(rName)); + xMaster->setPropertyValue(u"Name"_ustr, uno::Any(sName)); } xMaster->setPropertyValue(u"Content"_ustr, aValue); }