diff options
author | Björn Tantau <bjoern-tantau@users.noreply.github.com> | 2023-01-24 15:52:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-24 15:52:57 +0000 |
commit | 8d0fd823a4cec727bb2dd9075de26bf430c27824 (patch) | |
tree | cc82c96484fc925ad482499a4359cec204f643c4 | |
parent | ae1e59327fbdd333253fddae5f41cfade0dd6d87 (diff) | |
download | infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.tar infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.tar.gz infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.tar.bz2 infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.tar.lz infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.tar.xz infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.tar.zst infinity-for-reddit-8d0fd823a4cec727bb2dd9075de26bf430c27824.zip |
Only check for file extensions (#1299)
Links that end with jpeg without a dot before it are usually not images. Like here https://www.reddit.com/r/ProgrammerHumor/comments/zxro3m/weinersmith_has_escalated_the_gif_geif_vs_jiff/
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java index f8ce9884..96d55b09 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -114,7 +114,7 @@ public class LinkResolverActivity extends AppCompatActivity { path = path.substring(0, path.length() - 1); } - if (path.endsWith("jpg") || path.endsWith("png") || path.endsWith("jpeg")) { + if (path.endsWith(".jpg") || path.endsWith(".png") || path.endsWith(".jpeg")) { Intent intent = new Intent(this, ViewImageOrGifActivity.class); String url = uri.toString(); String fileName = FilenameUtils.getName(path); @@ -122,7 +122,7 @@ public class LinkResolverActivity extends AppCompatActivity { intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, fileName); intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, fileName); startActivity(intent); - } else if (path.endsWith("gif")) { + } else if (path.endsWith(".gif")) { Intent intent = new Intent(this, ViewImageOrGifActivity.class); String url = uri.toString(); String fileName = FilenameUtils.getName(path); @@ -130,7 +130,7 @@ public class LinkResolverActivity extends AppCompatActivity { intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, fileName); intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, fileName); startActivity(intent); - } else if (path.endsWith("mp4")) { + } else if (path.endsWith(".mp4")) { Intent intent = new Intent(this, ViewVideoActivity.class); intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_DIRECT); intent.putExtra(ViewVideoActivity.EXTRA_IS_NSFW, getIntent().getBooleanExtra(EXTRA_IS_NSFW, false)); |