From 33424ff671627c7829b2dc58f30ec41c5cfc6830 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Fri, 14 Aug 2020 11:12:34 +0000 Subject: [PATCH] [Library|Trunk] jsonld fix: if description is a number .substr function didn't work git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59283 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../service/open-aire-jsonld-converter.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts index 24eb9d8e..2d52b9f9 100644 --- a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts +++ b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts @@ -196,8 +196,8 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { private getDescription(result: any): String[] { const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null); if (!item) return this.getTitle(result); - let descr = Array.isArray(item) ? item[0]:item; - return [(descr.substring(0,4997)+(descr.substring(0,4997).length == 4997?'...':'')) as String]; + let descr = Array.isArray(item) ? item[0]:item + ""; // +"" to make string: if description is number descr.substring returns error + return [descr?(descr.substring(0,4997)+(descr.substring(0,4997).length == 4997?'...':'')):"" as String]; } private getDateCreated(result: any): String[] {