From 9358666fc419482241dc1a2d2458fe483b4593f1 Mon Sep 17 00:00:00 2001 From: "Jo G." <1451036+jo-elimu@users.noreply.github.com> Date: Sun, 1 Dec 2024 20:33:03 +0700 Subject: [PATCH] fix: download url #129 --- .../ai/elimu/content_provider/ui/image/ImagesFragment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ai/elimu/content_provider/ui/image/ImagesFragment.java b/app/src/main/java/ai/elimu/content_provider/ui/image/ImagesFragment.java index 79e51ce..a3d9f3e 100644 --- a/app/src/main/java/ai/elimu/content_provider/ui/image/ImagesFragment.java +++ b/app/src/main/java/ai/elimu/content_provider/ui/image/ImagesFragment.java @@ -147,7 +147,9 @@ public void run() { if (!imageFile.exists()) { // Download file bytes BaseApplication baseApplication = (BaseApplication) getActivity().getApplication(); - String downloadUrl = baseApplication.getBaseUrl() + imageGson.getBytesUrl(); + String downloadUrl = imageGson.getBytesUrl().startsWith("http") + ? imageGson.getBytesUrl() + : baseApplication.getBaseUrl() + imageGson.getBytesUrl(); Log.i(getClass().getName(), "downloadUrl: " + downloadUrl); byte[] bytes = MultimediaDownloader.downloadFileBytes(downloadUrl); Log.i(getClass().getName(), "bytes.length: " + bytes.length);