Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
block image/jpeg;base64 using url filter

I using WebViewClient's shouldInterceptRequest function to filter photos in my android webView.

The problem
I'm trying to block google's base64 URL photos (like:data:image/jpeg;base64,+) using this regex data:image/(jpg|png|jpeg);base64, but without success.

I done my research and found that:

these base64 background images are injected with JS.

but I don't know to continue.

my code:

@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
    String url = request.getUrl().toString();
    if (imgCheck(url,res))
    {

        return new WebResourceResponse(
                BrowserUnit.MIME_TYPE_TEXT_PLAIN,
                BrowserUnit.URL_ENCODING,
                new ByteArrayInputStream("".getBytes())
        );
    }
    return super.shouldInterceptRequest(view, request);
}

private static boolean isImage(String url, Resources res) {
        BufferedReader imageUrlRegex = openRawFile(res, R.raw.image_regex);
        try {
            String line = imageUrlRegex.readLine();
            while (line != null) {
                Pattern pattern = Pattern.compile(line);
                if (pattern.matcher(url).find())
                    return true;
                line = imageUrlRegex.readLine();
            }
        } catch (IOException e) {
            e.printStackTrace();
            return true;
        }
        return false;
    }

data:image/(jpg|png|jpeg|svg|ico|webp|tif|tiff|bmp|eps|apng|avif|jfif|pjpeg|pjp|cur);base64,

**note : I tried block like this return url.contains("data:image"); still nothing

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda