Merge pull request #1601 from Abderahman88/FirstSpecialChar

This commit is contained in:
Hugo Bernier 2020-11-15 13:43:15 -05:00 committed by GitHub
commit e82d25092c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 6 deletions

View File

@ -47,6 +47,7 @@ Version|Date|Comments
1.0.13|April 28, 2020|Added support for Dynamic Data 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.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.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 ## Disclaimer

View File

@ -3,7 +3,7 @@
"solution": { "solution": {
"name": "React Content Query", "name": "React Content Query",
"id": "00406271-0276-406f-9666-512623eb6709", "id": "00406271-0276-406f-9666-512623eb6709",
"version": "1.0.15.0", "version": "1.0.16.0",
"isDomainIsolated": false, "isDomainIsolated": false,
"includeClientSideAssets": true, "includeClientSideAssets": true,
"developer": { "developer": {

View File

@ -1,6 +1,6 @@
{ {
"name": "react-content-query-webpart", "name": "react-content-query-webpart",
"version": "1.0.12", "version": "1.0.15",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "react-content-query-webpart", "name": "react-content-query-webpart",
"version": "1.0.15", "version": "1.0.16",
"private": true, "private": true,
"main": "lib/index.js", "main": "lib/index.js",
"engines": { "engines": {

View File

@ -583,10 +583,14 @@ export class ContentQueryService implements IContentQueryService {
for (let result of results) { for (let result of results) {
let normalizedResult: any = {}; 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) { 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"); formattedName = formattedName.replace(/_x00$/, "_x005f_x00");
normalizedResult[viewField] = { normalizedResult[viewField] = {
textValue: result.FieldValuesAsText[formattedName], textValue: result.FieldValuesAsText[formattedName],