diff --git a/utils/dataTransfer/transferData.component.ts b/utils/dataTransfer/transferData.component.ts index 2e979f7f..bb53b68e 100644 --- a/utils/dataTransfer/transferData.component.ts +++ b/utils/dataTransfer/transferData.component.ts @@ -71,6 +71,11 @@ export class EGIDataTransferComponent { jobId = null; statusMessage = null; jobStatus; + + public s3UrlRegex = 's3:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.' + + '[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|s3:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.' + + '[a-zA-Z0-9]+\.[^\s]{2,}' + constructor(private http: HttpClient, private location: Location, private _router: Router, private cdr: ChangeDetectorRef) { } @@ -476,7 +481,7 @@ export class EGIDataTransferComponent { validateDestinationUrl():boolean { if(this.selectedDestination.destination == "s3") { - return (this.destinationUrl.length > 0 && new RegExp('s3:\/\/[a-zA-Z0-9]+').test(this.destinationUrl)); + return (this.destinationUrl.length > 0 && new RegExp("("+this.s3UrlRegex+")|("+StringUtils.urlRegex+")").test(this.destinationUrl)); } return (this.destinationUrl.length > 0 && StringUtils.isValidUrl(this.destinationUrl)); } @@ -484,7 +489,9 @@ export class EGIDataTransferComponent { public sourceUrlValidators() { this.URLValidators = []; if(this.selectedDestination.destination == 's3') { - this.URLValidators = [Validators.required, Validators.pattern('s3:\/\/[a-zA-Z0-9]+')]; + this.URLValidators = [Validators.required, Validators.pattern("("+this.s3UrlRegex+")|("+StringUtils.urlRegex+")")]; + // this.URLValidators = [Validators.required, Validators.pattern(this.s3UrlRegex) || StringUtils.urlValidator]; + // this.URLValidators = [Validators.required, Validators.pattern(this.s3UrlRegex)]; } else { this.URLValidators = [Validators.required, StringUtils.urlValidator()]; }