diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 15f6b5cd..7616a900 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -172,7 +172,7 @@ export class DataProviderComponent { this.updateTitle("Content provider"); this.updateDescription(""); this.datasourceId = data['datasourceId']; - if (this.datasourceId) { + if (this.datasourceId && StringUtils.isOpenAIREID(this.datasourceId)) { this.initializeValues(); this.getDataProviderInfo(this.datasourceId); } else { diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 99103bdb..926e4da2 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -159,7 +159,7 @@ export class OrganizationComponent { this.organizationId = params['organizationId']; - if (this.organizationId) { + if (this.organizationId && StringUtils.isOpenAIREID(this.organizationId)) { this.getOrganizationInfo(); } else { this.showLoading = false; diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 61d2d8b9..ce7edf19 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -186,7 +186,7 @@ export class ProjectComponent { var funder = params['funder']; - if (this.projectId) { + if (this.projectId && StringUtils.isOpenAIREID(this.projectId)) { this.getProjectInfo(this.projectId); this.actionsAfterLoadId(); } else if (grantId && funder) { diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 54b4a312..60459ba0 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -16,6 +16,7 @@ import {MetricsService} from "../../services/metrics.service"; import {RelationResult, ResultPreview} from "../../utils/result-preview/result-preview"; import {IndexInfoService} from "../../utils/indexInfo.service"; import {FormBuilder, FormGroup} from "@angular/forms"; +import {StringUtils} from "../../utils/string-utils.class"; @Component({ @@ -165,7 +166,7 @@ export class ResultLandingComponent { this.metricsClicked = false; - if (this.id) { + if (this.id && StringUtils.isOpenAIREID(this.id)) { this.getProvenanceVocabularyAndResultLandingInfo(); } else { this.showLoading = false; diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 874948e6..b251dadb 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -770,7 +770,13 @@ export class NewSearchPageComponent { } private static createQuotedKeywordQuery(fieldValue, fieldId, fieldOperator, countParams:number, isSearchAll:boolean, forceQuotted:boolean=false){ let params = ""; - let quotedParts = (fieldValue)?fieldValue.match(/(["'])(.*?)*?\1/g):[]; + let countQuote = (fieldValue.match(/'/g) || []).length; + let countDoubleQuote = (fieldValue.match(/"/g) || []).length; + let quotedParts = []; + if(countQuote % 2 == 0 && countDoubleQuote % 2 ==0){ + console.log("Allow quoting"); + quotedParts = (fieldValue)?fieldValue.match(/(["'])(.*?)*?\1/g):[]; + } // params+= (countParams == 0 ? "" : fieldOperator) + params+= " ("; if(forceQuotted){ diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index 08fee2f1..383d0d5f 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -263,6 +263,12 @@ export class StringUtils { "Portugal", "Romania", "Russia", "San Marino", "Serbia", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", "Turkey", "Ukraine", "United Kingdom", "Vatican City", ]; return (country && countries.indexOf(country) != -1); - + } + public static isOpenAIREID(id:string){ + if(id && id.length == 46){ + let exp1 = /^.{12}::([0-9a-z]{32})$/g; + return (id.match(exp1)!=null); + } + return false; } }