Android: Using "site" query parameter results in "Unable to open this type of link"

App version

5.9.1 (50901) (via F-Droid)

Device make and model

OnePlus 5

Android version

8.1.0

Steps to reproduce the bug

  1. Into the address bar type foo site:duckduckgo.com (or any query + any site)

  2. Press enter (try to load page)

Expected behavior

A DuckDuckGo search opens with the query

Actual behavior

A toast pops up briefly with the phrase “Unable to open this type of link”

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Hello @GuiltyDolphin and the rest of followers here. After internal discussion with the team, we’ve agreed that there’s no plan in the foreseeable future to do changes in how our address bar handles concrete keyboards or patterns as we do on our SERP page. Should this change in the future, we’ll update this conversation appropriately.

For now, closing this issue as the main complaint was fixed some time ago.

Thanks for all the activity here. I have accepted one PR that goes most of the way towards fixing this, however there are still a number of edge cases. While foo site:duckduckgo.com now works site:duckduckgo.com foo and site:duckduckgo.com do not.

It is quite tricky to fix this without breaking other links so this will require some wider refactoring. We have logged the problem internally and will clean it up soon. Thanks again for bringing it to our attention.

Internal link: https://app.asana.com/0/361428290920652/1126831098940688

@In2deep73 please go ahead as I have not started working on it yet.

The Problem

The problem is likely to be found in SpecialUrlDetector. We recently switched things around to better handle custom app schemes, and in the process broke queries like this that look like a URL scheme but should just be treated as a normal search query.

The BrowserTabViewModel calls the SpecialUrlDetector and the input is likely (wrongly) determined to be an IntentType which results in trying to launch an external app. You can see that error message being shown in externalAppLinkClicked() function of BrowserTabFragment.

The Solution

I’m not sure right now; I haven’t had time to think it through. But feel free to propose ideas before getting into the weeds of fixing the code if you want to bounce ideas on it.

Relevant links

https://github.com/duckduckgo/Android/blob/develop/app/src/main/java/com/duckduckgo/app/browser/SpecialUrlDetector.kt#L42

https://github.com/duckduckgo/Android/blob/develop/app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt#L246

https://github.com/duckduckgo/Android/blob/develop/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt#L386

Thanks for reporting the site: problem; that was an unintended regression of another recent change.

Happy to accept a PR for this if someone wants to pick it up. And thanks in advance, if so!