Fixed missing header images for some articles

This commit is contained in:
PaulStets 2018-05-24 15:30:18 +03:00 committed by Alex Sytnyk
parent d1d6eaeb73
commit 4fad525359

View file

@ -8,6 +8,8 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.Size; import android.support.annotation.Size;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.GPXFile;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
@ -102,6 +104,7 @@ public class TravelArticle {
@NonNull @NonNull
public static String getImageUrl(@NonNull String imageTitle, boolean thumbnail) { public static String getImageUrl(@NonNull String imageTitle, boolean thumbnail) {
imageTitle = imageTitle.replace(" ", "_");
try { try {
imageTitle = URLDecoder.decode(imageTitle, "UTF-8"); imageTitle = URLDecoder.decode(imageTitle, "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
@ -120,7 +123,7 @@ public class TravelArticle {
@Size(2) @Size(2)
@NonNull @NonNull
private static String[] getHash(@NonNull String s) { private static String[] getHash(@NonNull String s) {
String md5 = new String(Hex.encodeHex(DigestUtils.md5(s.replace(" ", "_")))); String md5 = new String(Hex.encodeHex(DigestUtils.md5(s)));
return new String[]{md5.substring(0, 1), md5.substring(0, 2)}; return new String[]{md5.substring(0, 1), md5.substring(0, 2)};
} }
} }