base url fix www
This commit is contained in:
parent
845039f9df
commit
440de74e00
@ -17,7 +17,7 @@ export class UrlTextPipe implements PipeTransform {
|
|||||||
export class UrlBasePipe implements PipeTransform {
|
export class UrlBasePipe implements PipeTransform {
|
||||||
|
|
||||||
httpPattern = /(\b(https?:\/\/)([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]))/ig;
|
httpPattern = /(\b(https?:\/\/)([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]))/ig;
|
||||||
|
|
||||||
transform(value: string): any {
|
transform(value: string): any {
|
||||||
if (!value.match(this.httpPattern)) {
|
if (!value.match(this.httpPattern)) {
|
||||||
return '';
|
return '';
|
||||||
@ -29,6 +29,12 @@ export class UrlBasePipe implements PipeTransform {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts[2];
|
let baseUrl = parts[2];
|
||||||
|
|
||||||
|
if (baseUrl.startsWith('www.')) {
|
||||||
|
baseUrl = baseUrl.substr(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user