Universal links opening all paths instead of only matching ones

I'm having an issue with all paths on the website being opened with the app rather than just the ones listed in the paths portion of the apple-app-site-association. I have paths with wildcards along the lines of "/??/*/dir/*" and I am using beta 5.


We already had an apple-app-site-association file prior to this for the purposes of handoff and actually when I first tested universal links the file had not been updated yet so it did not include the applinks section and yet the app still opened all links to our website. This makes me wonder if this information is getting ignored, has anyone gotten universal links to only open matched paths or have any suggestions?

Replies

Hi John,


At least as of Beta 4 (upgrading to 5 currently), I wasn't seeing this behavior. I have paths: [ "/foo/*" ] as an example for my site, and see redirections *not* occurring for the root (/index.html), but occuring as expected for /foo/bar for example.


Note, however, that paths are not regexes. You can only do /prefix/*, nothing fancier than that.

There is an example on this page of "/foo/*/bar/201?/mypage" which makes me think my paths are legal. However I have noticed now that removing the entire applinks section does stop any link from being opened in the app but with the paths it opens everything.

Interesting, I wonder if this behavior has changed. The keynote for this made no mention of such a feature, and went as far as pointing out "path prefixes." I thought I had read that regexes weren't supported, but perhaps I was wrong. So, for your example specifically, I'm not sure what the expected behavior would be.



/??/*/dir/*


Appears to me like / [Optional] [Optional again?] followed by /*/dir/*, so anything with dir in the path should match. However, I'm not sure if the first two ?s are valid like that, which may be your problem.

I don't think it is regex, it is the traditional path wildcards. ? means any one character, * means 1 or more characters. So I think /??/*/dir/* would be /[any folder with exactly 2 chars]/[any folder]/dir/[anything].

Ah, you are right. Surprising choice of syntax, imo. Have you tried any other variations of the path, like hardcoding a specifc subpath to see if that made the matching more specific? I think I've seen someone who also reported issues with *everything* deep linking when they had another handoff service enabled, but I could be wrong again 😉

I just tried with a single path a la "/somepage" and it still opens everything 😟

In that case, you may want to consider logging a bug with Apple (bugreport.apple.com), as this doesn't sound like expected behavior to me. With the newer beta content, they've been more responsive than they typically are to released content bugs.

I had this exact same issue until I started using the new apple-site-association format.


Make sure you don't get the following warning:


"An apple-app-site-association file was found but it is using the old format."


when using the App Search API Validation Tool (https://search.developer.apple.com/appsearch-validation-tool/).


Hope it helps!