Branch sdk generates very long links when adding custom params

67 views Asked by At

Bug:

When I add custom parameters to link properties while generating a short link, I receive a very large link like: https://app.evershop.ai/a/key_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?%24randomized_bundle_token=1253323032068742588&tags=influencer&alias=u/testuser7140&channel=influencer&feature=influencer&source=ios&data=eyIkbG9jYWxseV9pbmRleGFibGUiOnRydWUsIiRvZ190aXRsZSI6IkV2ZXJTaG9wIEluZmx1ZW5jZXIiLCIka2V5d29yZHMiOlsiaW5mbHVlbmNlciJdLCIkcHVibGljbHlfaW5kZXhhYmxlIjp0cnVlLCIkY2Fub25pY2FsX3VybCI6Imh0dHBzOi8vd2ViLmV2ZXJzaG9wLmFpL3UvdGVzdHVzZXI3MTQwIiwiJGNhbm9uaWNhbF9pZGVudGlmaWVyIjoiZXZlcnNob3AvaW5mbHVlbmNlciJ9. This started happening when I added custom params i.e. $android_url and $ios_url, to redirect the user to webpage if the app is not installed

To Reproduce:

This is my link generating code:

return await FlutterBranchSdk.getShortUrl(
        buo: BranchUniversalObject(
          canonicalIdentifier: 'evershop/post',
          canonicalUrl: 'https://web.evershop.ai/p/$id',
          title: 'EverShop Post',
          keywords: ['post'],
        ),
        linkProperties: BranchLinkProperties(
          tags: ['post'],
          campaign: 'post',
          feature: 'post',
          channel: 'post',
          alias: 'p/$id',
        )
          ..addControlParam('\$uri_redirect_mode', '1')
          ..addControlParam('\$ios_url', 'https://web.evershop.ai/p/$id')
          ..addControlParam('\$android_url', 'https://web.evershop.ai/p/$id'),
      );

Expected behavior:

The sdk should generate a link like https://app.evershop.ai/u/testuser7140 which should be redirected to webapge https://web.evershop.ai/u/testuser7140 if the app is not installed.

Simulator:

  • Flutter: version: 3.16.4
  • Package version: ^6.6.0
  • OS: iOS 16.4
  • Device: iPhone Xs

Web:

  • Flutter: version: 3.16.4
  • Package version: ^6.6.0
  • OS: Mac
  • Browser Chrome
  • Version 120.0.6099.199
1

There are 1 answers

0
ARSALAN AHMAD 74 On BEST ANSWER

I am not able to replicate the issue, but usually there's a fallback method set in SDK that gives long link when the short URL requests fails due to network conditions. Additionally seeing at your getShortUrl method I can verify that the alias getting set is wrong. The quick link that you are accessing is invalid and we don't currently support single character path segments after the domain (/a/, /b/, /c/, etc). Make sure you use a correct quick link for redirection to work effectively.

Reach out to [email protected] for any additional concerns