Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

664
Visualizações
Image saved in blob returns net error::ERR_UNKNOWN_URL_SCHEME Angular

I’m trying to migrate my app from Electron to Angular, my goal is to show an image uploaded by a user and to do this I did this :

page.component.ts

 uploadImageFile(){
    fileDialog({}, files =>{ //I use the fileDialog library that returns a FileList
      if(files[0])
      {
        this.filePath=URL.createObjectURL(files[0])
      return this.sanitizer.bypassSecurityTrustUrl(this.filePath)
      }else{console.log(":/"); return false};
    })
}

page.component.html

img src="{{filePath}}" ngif="filePath" class="image2" width="200" height="250">

But the program returns this error:

WARNING: sanitizing unsafe URL value blob:http://localhost:4200/3f4bdf10-8080-4f4b-ba3f-15a7f85c6d69 (see https://g.co/ng/security#xss)

GET unsafe:blob:http://localhost:4200/3f4bdf10-8080-4f4b-ba3f-15a7f85c6d69 net::ERR_UNKNOWN_URL_SCHEME

Any advice on how to fix it?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Bypass security and trust the given value to be a safe for style URL and Resource URL

In this case you need to use bypassSecurityTrustUrl which means

a value that can be used in hyperlinks or <img src>

bypassSecurityTrustResourceUrl which means

a location that may be used to load executable code from, like <script src>, or <iframe src>.

I hope you are clear with this solution

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda