Skip to content

android: Fix IntentFilter to not match all URLs #329

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

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

Conversation

kennylevinsen
Copy link
Contributor

Intent filters can match on the data of an intent through the tag. When multiple tags are present, they act as a boolean OR, intended if you want to match multiple data types. When a boolean AND is required, the attributes should instead be added to a single tag.

Two of our intent filters try to match ".pbw" and ".pbz" files. These both start with a single match on the "content" schema, followed by a match on the "/" MIME type, and finally a path filter for the file type in question. By virtue of being boolean OR, this meant that both filters would match every possible URL.

Combine the attributes in a single data tag to turn it into a boolean AND for both of these filters.

Intent filters can match on the data of an intent through the <data>
tag. When multiple tags are present, they act as a boolean OR, intended
if you want to match multiple data types. When a boolean AND is
required, the attributes should instead be added to a single <data> tag.

Two of our intent filters try to match ".pbw" and ".pbz" files. These
both start with a single match on the "content" schema, followed by a
match on the "*/*" MIME type, and finally a path filter for the file
type in question. By virtue of being boolean OR, this meant that both
filters would match every possible URL.

Combine the attributes in a single data tag to turn it into a boolean
AND for both of these filters.
@@ -101,9 +101,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="content" />
<data android:mimeType="*/*" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know about pbz, but pbw is a zip archive, so you can use that mime type for it

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.

2 participants