Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24695] Android: ImageView.image fails when URL contains multiple question marks

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-06-28T22:03:46.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.2.0
ComponentsAndroid
Labelsimageview
ReporterDan Noa
AssigneeJoshua Quick
Created2017-05-14T11:39:19.000+0000
Updated2017-08-17T01:48:12.000+0000

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)

Comments

  1. Hans Knöchel 2017-05-15

    The second URL doesn't even run on normal browsers, it's throwing n 403 error. So probably it's linked to an access token or authorized content, this is no Android issue.
  2. Dan Noa 2017-05-15

    Yes it will not run because it has wrongly been encoded on Android. Same url works perfectly on ios. If you check the sample url i posted, you will see it's a valid one and loads properly in the browser.
  3. Hans Knöchel 2017-05-15

    Ok, it's clear now. So it's not the loading of the URL but the encoding of it. Waiting for support to validate it, but it looks valid for me!
  4. Sharif AbuDarda 2017-05-15

    Hello, I can verify the issue in Android. The image does not load and there is the error. Tested with SDK 6.0.4.GA and CLI 6.2.0. Tested in Android 6.0.2.device. Working for iOS though. Tested with 10.2 simulator. Moving to engineering.
  5. Gary Mathews 2017-05-30

    -master: https://github.com/appcelerator/titanium_mobile/pull/9097-
  6. Joshua Quick 2017-06-28

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9178
  7. Lokesh Choudhary 2017-06-28

    FR Passed.
  8. Lokesh Choudhary 2017-08-17

    Verified the fix in SDK 7.0.0.v20170816113226 & 6.2.0.v20170816173122. Closing. Studio Ver: 4.9.1.201707200100 SDK Ver: 6.2.0.v20170816173122, 7.0.0.v20170816113226 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.3 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.13 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1

JSON Source