Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for 'Remove All entries from this domain' on history item #1605

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fnkkio
Copy link
Contributor

@fnkkio fnkkio commented Nov 12, 2019

Fixes #1604

@Emdek
Copy link
Member

Emdek commented Nov 12, 2019

I'm not sure what should be the proper approach here, one thing is for sure, QRegExp shouldn't be used in new code and it is not needed here at all.
www. is just an optional subdomain, perhaps we should match all subdomains? Or maybe split it into two actions...
Could you please check how similar features behave elsewhere in such cases?

@fnkkio
Copy link
Contributor Author

fnkkio commented Nov 13, 2019

I revised my previous commit and came up with a better solution.

return {};
}

const int domainStartIdx = host.lastIndexOf('.', (-1 * tld.size()) - 1) + 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+1' at the end because:

  • in case lastIndexOf does not find a dot, it will return -1, adding 1 will set the domainStartIdx to 0
  • in case lastIndexOf does find a dot, it should return the idx after the dot

ie.
220.ro -> lastIndexOf returns -1, we add 1, domainStartIdx = 0, return value = 220.ro
vid.220.ro -> lastIndexOf returns 3, we add 1, domainStartIdx = 4, return value = 220.ro

@fnkkio
Copy link
Contributor Author

fnkkio commented Dec 19, 2019

@Emdek Do you think this is the right approach ? (In the latest version of this PR I am removing history items for the domain and all its subdomains)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Remove All entries from this domain' on history item does not work as expected
2 participants