Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(audio): sanitize audio url (DSP-1819) (#513)
  • Loading branch information
kilchenmann committed Sep 2, 2021
1 parent 83d5874 commit 35871cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
@@ -1,4 +1,4 @@
<audio controls >
<source [src]="src.fileValue.fileUrl" type="audio/mpeg">
<audio controls preload="auto">
<source [src]="audio" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
@@ -1,4 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';

import { FileRepresentation } from '../file-representation';

@Component({
Expand All @@ -10,11 +12,14 @@ export class AudioComponent implements OnInit {

@Input() src: FileRepresentation;

audio: SafeUrl;

constructor() { }
constructor(
private _sanitizer: DomSanitizer
) { }

ngOnInit(): void {

this.audio = this._sanitizer.bypassSecurityTrustUrl(this.src.fileValue.fileUrl);
}

}

0 comments on commit 35871cd

Please sign in to comment.