ErrorxCode/EasyInsta

Bug, checking image extension when sending image message

Closed this issue · 1 comments

Instagram.java

    public AsyncTask<Void> directMessage(@NotNull String username, @NotNull File photo) {
        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);

         ....
    }
    
    ==> || to &&
    
     public AsyncTask<Void> directMessage(@NotNull String username, @NotNull File photo) {
        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);

         ....
    }       

Thanks for figuring out this bug. You should create a pull request editing the code yourself. Go ahead 👍🏻