mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-28 02:24:45 +01:00
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/
This commit is contained in:
parent
ae1e59327f
commit
8d0fd823a4
@ -114,7 +114,7 @@ public class LinkResolverActivity extends AppCompatActivity {
|
|||||||
path = path.substring(0, path.length() - 1);
|
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);
|
Intent intent = new Intent(this, ViewImageOrGifActivity.class);
|
||||||
String url = uri.toString();
|
String url = uri.toString();
|
||||||
String fileName = FilenameUtils.getName(path);
|
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_FILE_NAME_KEY, fileName);
|
||||||
intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, fileName);
|
intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, fileName);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (path.endsWith("gif")) {
|
} else if (path.endsWith(".gif")) {
|
||||||
Intent intent = new Intent(this, ViewImageOrGifActivity.class);
|
Intent intent = new Intent(this, ViewImageOrGifActivity.class);
|
||||||
String url = uri.toString();
|
String url = uri.toString();
|
||||||
String fileName = FilenameUtils.getName(path);
|
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_FILE_NAME_KEY, fileName);
|
||||||
intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, fileName);
|
intent.putExtra(ViewImageOrGifActivity.EXTRA_POST_TITLE_KEY, fileName);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (path.endsWith("mp4")) {
|
} else if (path.endsWith(".mp4")) {
|
||||||
Intent intent = new Intent(this, ViewVideoActivity.class);
|
Intent intent = new Intent(this, ViewVideoActivity.class);
|
||||||
intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_DIRECT);
|
intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_DIRECT);
|
||||||
intent.putExtra(ViewVideoActivity.EXTRA_IS_NSFW, getIntent().getBooleanExtra(EXTRA_IS_NSFW, false));
|
intent.putExtra(ViewVideoActivity.EXTRA_IS_NSFW, getIntent().getBooleanExtra(EXTRA_IS_NSFW, false));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user