From 70123cbba52eebfecc3b7af0c04da4269a8460b0 Mon Sep 17 00:00:00 2001 From: Abderahman88 Date: Sat, 14 Nov 2020 22:40:38 +0100 Subject: [PATCH 1/2] fix field begins with a special character --- samples/react-content-query-webpart/Online/README.md | 1 + .../Online/config/package-solution.json | 2 +- .../Online/src/common/services/ContentQueryService.ts | 10 +++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/samples/react-content-query-webpart/Online/README.md b/samples/react-content-query-webpart/Online/README.md index 763be2ae7..54ec7556e 100644 --- a/samples/react-content-query-webpart/Online/README.md +++ b/samples/react-content-query-webpart/Online/README.md @@ -47,6 +47,7 @@ Version|Date|Comments 1.0.13|April 28, 2020|Added support for Dynamic Data 1.0.14|October 30, 2020|Fixed (lookup-)fields with special characters 1.0.15|November 2, 2020|Upgraded to SPFx 1.11; Added support for jsonValue +1.0.16|November 14, 2020|Fixed a bug where the fieldname starts with a special character; Added more special characters ## Disclaimer diff --git a/samples/react-content-query-webpart/Online/config/package-solution.json b/samples/react-content-query-webpart/Online/config/package-solution.json index ee4739e38..4e68eb2f9 100644 --- a/samples/react-content-query-webpart/Online/config/package-solution.json +++ b/samples/react-content-query-webpart/Online/config/package-solution.json @@ -3,7 +3,7 @@ "solution": { "name": "React Content Query", "id": "00406271-0276-406f-9666-512623eb6709", - "version": "1.0.15.0", + "version": "1.0.16.0", "isDomainIsolated": false, "includeClientSideAssets": true, "developer": { diff --git a/samples/react-content-query-webpart/Online/src/common/services/ContentQueryService.ts b/samples/react-content-query-webpart/Online/src/common/services/ContentQueryService.ts index 298e172d5..3be21f042 100644 --- a/samples/react-content-query-webpart/Online/src/common/services/ContentQueryService.ts +++ b/samples/react-content-query-webpart/Online/src/common/services/ContentQueryService.ts @@ -583,10 +583,14 @@ export class ContentQueryService implements IContentQueryService { for (let result of results) { let normalizedResult: any = {}; - let formattedCharsRegex = /_x00(20|3a|e0|e1|e2|e7|e8|e9|ea|ed|f3|f9|fa|fc)_/gi; - + let formattedCharsRegex = /_x00(20|3a|[c-f]{1}[0-9a-f]{1})_/gi; for (let viewField of viewFields) { - let formattedName = viewField.replace(formattedCharsRegex, "_x005f_x00$1_x005f_"); + //check if the intenal fieldname begins with a special character (_x00) + let viewFieldOdata = viewField; + if (viewField.indexOf("_x00") == 0) { + viewFieldOdata = `OData_${viewField}`; + } + let formattedName = viewFieldOdata.replace(formattedCharsRegex, "_x005f_x00$1_x005f_"); formattedName = formattedName.replace(/_x00$/, "_x005f_x00"); normalizedResult[viewField] = { textValue: result.FieldValuesAsText[formattedName], From bdb04da2ff38b69c439d0f2a1c5da6068beef915 Mon Sep 17 00:00:00 2001 From: Hugo Bernier Date: Sun, 15 Nov 2020 13:39:29 -0500 Subject: [PATCH 2/2] Fixed package version --- samples/react-content-query-webpart/Online/package-lock.json | 2 +- samples/react-content-query-webpart/Online/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/react-content-query-webpart/Online/package-lock.json b/samples/react-content-query-webpart/Online/package-lock.json index b7ac5266c..29f57260b 100644 --- a/samples/react-content-query-webpart/Online/package-lock.json +++ b/samples/react-content-query-webpart/Online/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-content-query-webpart", - "version": "1.0.12", + "version": "1.0.15", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/samples/react-content-query-webpart/Online/package.json b/samples/react-content-query-webpart/Online/package.json index d84a15063..f038665f1 100644 --- a/samples/react-content-query-webpart/Online/package.json +++ b/samples/react-content-query-webpart/Online/package.json @@ -1,6 +1,6 @@ { "name": "react-content-query-webpart", - "version": "1.0.15", + "version": "1.0.16", "private": true, "main": "lib/index.js", "engines": {