Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11218

Prompt method should not crash if a string is passed as button value

Details

    Description

      The prompt method expects an array as an argument in the command array, but there is no input validation requiring that it be an array. A string makes just as much sense for a single-button dialog, but if the API user sends a string, it crashes.

      Attachments

        Activity

          zellman Andrew Zellman added a comment -

          Please assign this to me.

          zellman Andrew Zellman added a comment - Please assign this to me.
          githubbot ASF GitHub Bot added a comment -

          GitHub user adzellman opened a pull request:

          https://github.com/apache/cordova-plugin-dialogs/pull/75

          CB-11218 iOS: Handle single button passed as string

          • If the buttons are passed in as a string, then
            create an array with that string as the only
            value.

          JIRA: https://issues.apache.org/jira/browse/CB-11218

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/adobe-marketing-cloud-mobile/cordova-plugin-dialogs CB-11218cordova-plugin-dialogs

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/cordova-plugin-dialogs/pull/75.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #75


          commit fe94dc0d8139d69d9189b1bc86b53f7a45f6c16a
          Author: Andrew Zellman <zellman@adobe.com>
          Date: 2016-05-06T17:50:58Z

          CB-11218 iOS: Handle single button passed as string

          • If the buttons are passed in as a string, then
            create an array with that string as the only
            value.

          githubbot ASF GitHub Bot added a comment - GitHub user adzellman opened a pull request: https://github.com/apache/cordova-plugin-dialogs/pull/75 CB-11218 iOS: Handle single button passed as string If the buttons are passed in as a string, then create an array with that string as the only value. JIRA: https://issues.apache.org/jira/browse/CB-11218 You can merge this pull request into a Git repository by running: $ git pull https://github.com/adobe-marketing-cloud-mobile/cordova-plugin-dialogs CB-11218 cordova-plugin-dialogs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-dialogs/pull/75.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #75 commit fe94dc0d8139d69d9189b1bc86b53f7a45f6c16a Author: Andrew Zellman <zellman@adobe.com> Date: 2016-05-06T17:50:58Z CB-11218 iOS: Handle single button passed as string If the buttons are passed in as a string, then create an array with that string as the only value.

          I have assigned it to you zellman This case should be handled in JavaScript so the fix will apply to all platforms.
          The confirm method already handles this case [1] but the prompt method currently does not.

          [1] https://github.com/apache/cordova-plugin-dialogs/blob/master/www/notification.js#L70

          purplecabbage Jesse MacFadyen added a comment - I have assigned it to you zellman This case should be handled in JavaScript so the fix will apply to all platforms. The confirm method already handles this case [1] but the prompt method currently does not. [1] https://github.com/apache/cordova-plugin-dialogs/blob/master/www/notification.js#L70
          githubbot ASF GitHub Bot added a comment -

          Github user adzellman closed the pull request at:

          https://github.com/apache/cordova-plugin-dialogs/pull/75

          githubbot ASF GitHub Bot added a comment - Github user adzellman closed the pull request at: https://github.com/apache/cordova-plugin-dialogs/pull/75
          githubbot ASF GitHub Bot added a comment -

          GitHub user adzellman opened a pull request:

          https://github.com/apache/cordova-plugin-dialogs/pull/76

          CB-11218 Convert button list to appropriate type

          • If the buttons are passed in as a comma-separated
            string, then create an array with those values.

          JIRA: https://issues.apache.org/jira/browse/CB-11218

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/adobe-marketing-cloud-mobile/cordova-plugin-dialogs CB-11218cordova-plugin-dialogs

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/cordova-plugin-dialogs/pull/76.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #76


          commit 28633f14e1f02db8440e6465246597cac7c809d0
          Author: Andrew Zellman <zellman@adobe.com>
          Date: 2016-05-06T19:17:24Z

          CB-11218 Convert button list to appropriate type

          • If the buttons are passed in as a comma-separated
            string, then create an array with those values.

          githubbot ASF GitHub Bot added a comment - GitHub user adzellman opened a pull request: https://github.com/apache/cordova-plugin-dialogs/pull/76 CB-11218 Convert button list to appropriate type If the buttons are passed in as a comma-separated string, then create an array with those values. JIRA: https://issues.apache.org/jira/browse/CB-11218 You can merge this pull request into a Git repository by running: $ git pull https://github.com/adobe-marketing-cloud-mobile/cordova-plugin-dialogs CB-11218 cordova-plugin-dialogs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-dialogs/pull/76.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #76 commit 28633f14e1f02db8440e6465246597cac7c809d0 Author: Andrew Zellman <zellman@adobe.com> Date: 2016-05-06T19:17:24Z CB-11218 Convert button list to appropriate type If the buttons are passed in as a comma-separated string, then create an array with those values.
          zellman Andrew Zellman added a comment - purplecabbage I've submitted a PR for the fix at https://github.com/apache/cordova-plugin-dialogs/pull/76
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/cordova-plugin-dialogs/pull/76

          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-dialogs/pull/76

          People

            zellman Andrew Zellman
            zellman Andrew Zellman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: