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

Created on 6 Sep 2018  路  13Comments  路  Source: duckduckgo/Android

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"

Discard bug

All 13 comments

I believe this is a feature request. Are PRs going to be accepted for this feature?

@dineshkv I think this is a bug (i.e., something broke) - I noticed it because I used to do it and it worked (it definitely works in version 5.7.5), but now no longer works

Oh okay. If I want to work on this are PRs going to be accepted?

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!

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

I have some fixes to propose if @dineshkv decides not to work on this.

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

Additional test case to cover under this fix: searches like std::fabs

A similar issue: inserting an ip specifying a port causes the same error (e.g. 192.168.1.34:8080). It's worth noticing that it works without specifying the port (192.168.1.34 redirects to http://192.168.1.34).
I personally find it quite annoying when testing a local web server. I could help with pleasure.

There's two things here that I think would really help a proper implementation:

  1. Schemes must start with a letter, and can only contain /A-Za-z0-9.+-/
  2. Spaces aren't allowed in a URI but can often be placed inside query parameters encoded. Spaces outside of query parameters should indicate a search.

I think implementing the regex is a good idea, and if the protocol isn't understood, perhaps it should perform a search instead. The best part about a privacy-centric search engine is searches have no side effects, so while accidental searches can be annoying, they aren't the end of the world.

I'd try implementing this and creating a PR but I'm having trouble building :(

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

This issue is occurring currently. Is anyone attending this? Can someone direct me to a site with instructions for getting a patch, if there is one? I'm totally NOT a coder nor familiar with language, just trying to find a remedy.

Thank you!!

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sephelps picture sephelps  路  3Comments

WillHick picture WillHick  路  3Comments

arunsathiya picture arunsathiya  路  3Comments

francescosoave picture francescosoave  路  4Comments

JeffAment picture JeffAment  路  4Comments