Skip to content

Commit

Permalink
[MOD] fixed bug, checking image extension for sending image messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-brandon committed Jul 30, 2023
1 parent 76fb0c8 commit ddbf5ab
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public AsyncTask<Void> directMessage(@NotNull String username, @NotNull String m
* @return A {@link AsyncTask} indication success or failure of the request
*/
public AsyncTask<Void> 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(() -> {
Expand Down

0 comments on commit ddbf5ab

Please sign in to comment.