Skip to content

Commit 3278019

Browse files
committed
Remove URL fragment when photon-izing an image URL
1 parent 71bd8cf commit 3278019

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/PhotonUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ public static String getPhotonImageUrl(String imageUrl, int width, int height, Q
4242
return imageUrl;
4343
}
4444

45+
// we have encountered some image urls that incorrectly have a # fragment part, which
46+
// must be removed before removing the query string
47+
int fragmentPos = imageUrl.indexOf("#");
48+
if (fragmentPos > 0) {
49+
imageUrl = imageUrl.substring(0, fragmentPos);
50+
}
51+
4552
// remove existing query string since it may contain params that conflict with the passed ones
4653
imageUrl = UrlUtils.removeQuery(imageUrl);
4754

0 commit comments

Comments
 (0)