diff --git a/EasyInsta/src/main/java/com/xcoder/easyinsta/Instagram.java b/EasyInsta/src/main/java/com/xcoder/easyinsta/Instagram.java index 0a869c1..17ebf30 100644 --- a/EasyInsta/src/main/java/com/xcoder/easyinsta/Instagram.java +++ b/EasyInsta/src/main/java/com/xcoder/easyinsta/Instagram.java @@ -307,7 +307,7 @@ public AsyncTask directMessage(@NotNull String username, @NotNull String m * @return A {@link AsyncTask} indication success or failure of the request */ public AsyncTask directMessage(@NotNull String username, @NotNull File photo) { - if (!photo.getName().endsWith(".jpg") || !photo.getName().endsWith(".png") || !photo.getName().endsWith("jpeg")) + if (!photo.getName().endsWith(".jpg") && !photo.getName().endsWith(".png") && !photo.getName().endsWith("jpeg")) throw new InstagramException("Unsupported file format. Only photos with jpg/png/jpeg extensions are allowed", Reasons.UNSUPPORTED_FILE_FORMAT); return AsyncTask.callAsync(() -> {