[BUG] PrivacyPolicyActivity WebView does not route non http(s) links out of the WebView
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc owncloudApp/src/main/java/com/owncloud/android/presentation/settings/privacypolicy/PrivacyPolicyActivity.kt và helper hiện có goToUrl(url) trong ActivityExt.kt. Kiểm tra cách WebView xử lý việc điều hướng liên kết, sau đó thêm hoặc cập nhật các bài kiểm thử tập trung nếu dự án có kiểm thử cho activity này. Công việc hoàn tất khi các liên kết HTTP(S) vẫn mở trong WebView và các scheme khác được chuyển cho trình xử lý của thiết bị, đồng thời giữ nguyên hành vi hiện tại khi không có trình xử lý phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Kotlin
- Star
- 4.2k
- Fork
- 3.1k
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của owncloud/android
-
Camera Uploads Contributions are welcome Technical
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
owncloud/android#5040 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
KW-related Type:bug UI / UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Lint reports an errorĐang mởType:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
owncloud/android#4485 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Contributions are welcome p3-medium Type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
owncloud/android#4300 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
owncloud/android#3720 · 8 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của owncloud/android
Issue tương tự
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsotto/sotto-authenticator#68 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 4 ngày
-
mobile prio:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
digitalfabrik/entitlementcard#3324 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
sameerasw/essentials#1913 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainer thường phản hồi trong vòng 1 ngày