base url fix www

This commit is contained in:
_Bastler 2021-10-06 12:59:46 +02:00
parent 845039f9df
commit 440de74e00

View File

@ -17,7 +17,7 @@ export class UrlTextPipe implements PipeTransform {
export class UrlBasePipe implements PipeTransform {
httpPattern = /(\b(https?:\/\/)([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]))/ig;
transform(value: string): any {
if (!value.match(this.httpPattern)) {
return '';
@ -29,6 +29,12 @@ export class UrlBasePipe implements PipeTransform {
return '';
}
return parts[2];
let baseUrl = parts[2];
if (baseUrl.startsWith('www.')) {
baseUrl = baseUrl.substr(4);
}
return baseUrl;
}
}