mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
16 lines
464 B
TypeScript
16 lines
464 B
TypeScript
import { Pipe, PipeTransform } from '@angular/core';
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
/**
|
|
* This pipe explicitly escapes the sanitization of a URL,
|
|
* only use this when you are sure the URL is indeed safe
|
|
*/
|
|
|
|
@Pipe({ name: 'dsSafeUrl' })
|
|
export class SafeUrlPipe implements PipeTransform {
|
|
constructor(private domSanitizer: DomSanitizer) { }
|
|
transform(url) {
|
|
return this.domSanitizer.bypassSecurityTrustResourceUrl(url);
|
|
}
|
|
}
|