Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24695

Android: ImageView.image fails when URL contains multiple question marks

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 6.2.0
    • Component/s: Android
    • Labels:
    • Environment:

      Mac OS X: 10.11.6
      Node.js: 6.10.0
      Titanium SDK: 6.0.4.GA
      Android: 6.0
      Device: Xiaomi Redmi 3X

    • Story Points:
      5
    • Sprint:
      2017 Sprint 13 SDK

      Description

      when the imageView path that contains multiple '?' symbol it will not get be encoded properly on Android.

      Sample Url:
      http://scontent.xx.fbcdn.net.rsz.io/v/t1.0-9/s720x720/17795851_419371511758070_7481565181564022529_n.jpg?oh=7772aea44d2f40fdbd42285ca61d7aac&oe=59771D60?mode=crop&width=333&height=250

      Notice there is 2 '?' in the url, the second one is encoded to %%3F by android as shown below:

      http://scontent.xx.fbcdn.net.rsz.io/v/t1.0-9/s720x720/17795851_419371511758070_7481565181564022529_n.jpg?oh=7772aea44d2f40fdbd42285ca61d7aac&oe=59771D60%%3Fmode=crop&width=333&height=250

      I tried using encodeUri but android still appends a % before the %3F symbol.

      Steps:
      1. Run sample code
      2. Check image in the browser to verify the URL is valid.

      Actual: Image does not appear
      Expected: Image must appear

      var window = Titanium.UI.createWindow({
       });
       
      var imageview = Ti.UI.createImageView({
      	image:'http://scontent.xx.fbcdn.net.rsz.io/v/t1.0-9/s720x720/17795851_419371511758070_7481565181564022529_n.jpg?oh=7772aea44d2f40fdbd42285ca61d7aac&oe=59771D60?mode=crop&width=333&height=250'
      })
       
      window.add(imageview);
      window.open();
      

      Logs:
      [ERROR] : TiDownloadManager: (pool-3-thread-1) [1302,1302] Exception downloading http://scontent.xx.fbcdn.net.rsz.io/v/t1.0-9/s720x720/17795851_419371511758070_7481565181564022529_n.jpg?oh=7772aea44d2f40fdbd42285ca61d7aac&oe=59771D60%%3Fmode=crop&width=333&height=250
      [ERROR] : TiDownloadManager: java.io.FileNotFoundException: http://scontent.xx.fbcdn.net.rsz.io/v/t1.0-9/s720x720/17795851_419371511758070_7481565181564022529_n.jpg?oh=7772aea44d2f40fdbd42285ca61d7aac&oe=59771D60%%3Fmode=crop&width=333&height=250
      [ERROR] : TiDownloadManager: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:238)
      [ERROR] : TiDownloadManager: at java.net.URL.openStream(URL.java:470)
      [ERROR] : TiDownloadManager: at org.appcelerator.titanium.util.TiDownloadManager$DownloadJob.run(TiDownloadManager.java:135)
      [ERROR] : TiDownloadManager: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      [ERROR] : TiDownloadManager: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      [ERROR] : TiDownloadManager: at java.lang.Thread.run(Thread.java:818)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                mdhuns Karimouny
                Reviewer:
                Gary Mathews
                Tester:
                Lokesh Choudhary
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-10689
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code