[BUG] PrivacyPolicyActivity WebView does not route non http(s) links out of the WebView
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee owncloudApp/src/main/java/com/owncloud/android/presentation/settings/privacypolicy/PrivacyPolicyActivity.kt y el helper existente goToUrl(url) en ActivityExt.kt. Comprueba cómo gestiona su WebView la navegación por enlaces y añade o actualiza pruebas específicas si el proyecto tiene cobertura para esta actividad. La tarea estará terminada cuando los enlaces HTTP(S) permanezcan en el WebView y los demás esquemas se deleguen al controlador del dispositivo, conservando el comportamiento existente cuando no haya ningún controlador disponible.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
PrivacyPolicyActivity (owncloudApp/src/main/java/com/owncloud/android/presentation/settings/privacypolicy/PrivacyPolicyActivity.kt) sets up its WebViewClient with only an onReceivedError override:
webViewClient = object : WebViewClient() {
override fun onReceivedError(view: WebView, errorCode: Int, description: String, failingUrl: String) {
showMessageInSnackbar(message = getString(R.string.privacy_policy_error) + description)
}
}
Because shouldOverrideUrlLoading is not overridden, every link the privacy policy page renders is loaded by the WebView itself. That has two visible effects:
- A
mailto:link in the policy text opens nothing. The WebView tries to loadmailto:[email protected]itself, fails, and the mail app never opens. - Any other non http(s) scheme that an app on the device could handle (
tel:,geo:,intent:,market:) is swallowed by the WebView the same way instead of being handed to that app.
The page is remote (url_privacy_policy, https://owncloud.com/android-app-privacy-policy/ by default, and a branded build can point it somewhere else), so which links it contains is outside the app's control.
Suggested fix
Override shouldOverrideUrlLoading so http(s) navigations stay in the WebView and any other scheme is routed out. ActivityExt.kt already has goToUrl(url), which launches Intent.ACTION_VIEW inside a try/catch for ActivityNotFoundException and shows the file_list_no_app_for_perform_action snackbar, so a missing handler does not crash the Activity:
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
val url = request?.url ?: return false
val scheme = url.scheme?.lowercase()
if (scheme == "http" || scheme == "https") return false
goToUrl(url.toString())
return true
}
The same gap was fixed in the OpenCloud fork of this app in opencloud-eu/android#165.
- Lenguaje dominante
- Kotlin
- Estrellas
- 4.2k
- Forks
- 3.1k
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de owncloud/android
-
Camera Uploads Contributions are welcome Technical
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
owncloud/android#5040 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
KW-related Type:bug UI / UX
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
[BUG] Lint reports an errorAbiertoType:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
owncloud/android#4485 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
Contributions are welcome p3-medium Type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
owncloud/android#4300 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
owncloud/android#3720 · 8 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de owncloud/android
Issues similares
-
enhancement good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
getsotto/sotto-authenticator#68 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 4 días
-
mobile prio:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
digitalfabrik/entitlementcard#3324 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
sameerasw/essentials#1913 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
micronaut-projects/micronaut-core#14585 ·
Los mantenedores suelen responder en 1 día