nextcloud / forms

📝 Simple form & survey app for Nextcloud
https://apps.nextcloud.com/apps/forms
GNU Affero General Public License v3.0
324 stars 98 forks source link

Exceptions when submitting a form which is supposed to save to a spreadsheet #2238

Closed nikkilocke closed 4 months ago

nikkilocke commented 4 months ago

Describe the bug When a user is filling in some forms, when they submit the form, they get an error message. The form is set to save the data to a spreadsheet. The data in the form is updated, but the spreadsheet isn't.

To Reproduce Try to submit a form.

Expected behaviour The form is submitted and the spreadsheet updated.

Nextcloud (please complete the following information):

Desktop (please complete the following information):

Additional context The Nextcloud log shows the following:

Exception
OC\Files\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528 in file '/var/www/html/lib/private/Files/View.php' line 1128
/var/www/html/lib/private/AppFramework/App.php
line 184
OC\AppFramework\Http\Dispatcher->dispatch(
  [
    "OCA\\Forms\\Controller\\ApiController"
  ],
  "insertSubmission"
)
/var/www/html/lib/private/Route/Router.php
line 315
OC\AppFramework\App::main(
  "OCA\\Forms\\Controller\\ApiController",
  "insertSubmission",
  [
    "OC\\AppFramework\\DependencyInjection\\DIContainer"
  ],
  [
    "v2.4",
    "ocs.forms.api.insertSubmission"
  ]
)
/var/www/html/ocs/v1.php
line 65
OC\Route\Router->match(
  "/ocsapp/apps/forms/api/v2.4/submission/insert"
)
/var/www/html/ocs/v2.php
line 23
undefinedundefinedrequire_once(
  "/var/www/html/ocs/v1.php"
)
Caused by TypeError
OC\Files\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528
Raw log entry
{
  "reqId": "tK7bAR19VERXEWlDhQh6",
  "level": 3,
  "time": "2024-07-08T15:01:21+00:00",
  "remoteAddr": "91.196.221.60",
  "user": "nedevans",
  "app": "no app in context",
  "method": "POST",
  "url": "/ocs/v2.php/apps/forms/api/v2.4/submission/insert",
  "message": "Exception thrown: Exception",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
  "version": "28.0.6.1",
  "exception": {
    "Exception": "Exception",
    "Message": "OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528 in file '/var/www/html/lib/private/Files/View.php' line 1128",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Forms\\Controller\\ApiController"
          ],
          "insertSubmission"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Forms\\Controller\\ApiController",
          "insertSubmission",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "v2.4",
            "ocs.forms.api.insertSubmission"
          ]
        ]
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 65,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/forms/api/v2.4/submission/insert"
        ]
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 169,
    "Previous": {
      "Exception": "TypeError",
      "Message": "OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/Files/View.php",
          "line": 528,
          "function": "basicOperation",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            "file_exists",
            null
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/Filesystem.php",
          "line": 545,
          "function": "file_exists",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            null
          ]
        },
        {
          "file": "/var/www/html/apps/files_versions/lib/Storage.php",
          "line": 190,
          "function": "file_exists",
          "class": "OC\\Files\\Filesystem",
          "type": "::",
          "args": [
            null
          ]
        },
        {
          "file": "/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php",
          "line": 196,
          "function": "store",
          "class": "OCA\\Files_Versions\\Storage",
          "type": "::",
          "args": [
            null
          ]
        },
        {
          "file": "/var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php",
          "line": 102,
          "function": "write_hook",
          "class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
          "type": "->",
          "args": [
            [
              "OC\\Files\\Node\\File"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
          "line": 86,
          "function": "handle",
          "class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
          "type": "->",
          "args": [
            [
              "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 230,
          "function": "__invoke",
          "class": "OC\\EventDispatcher\\ServiceEventListener",
          "type": "->",
          "args": [
            [
              "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
            ],
            "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent",
            [
              "Symfony\\Component\\EventDispatcher\\EventDispatcher"
            ]
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 59,
          "function": "callListeners",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              [
                "Closure"
              ],
              [
                "Closure"
              ]
            ],
            "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent",
            [
              "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 94,
          "function": "dispatch",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
            ],
            "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 106,
          "function": "dispatch",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent",
            [
              "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/Node/HookConnector.php",
          "line": 100,
          "function": "dispatchTyped",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              "OCP\\Files\\Events\\Node\\BeforeNodeWrittenEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/legacy/OC_Hook.php",
          "line": 105,
          "function": "write",
          "class": "OC\\Files\\Node\\HookConnector",
          "type": "->",
          "args": [
            [
              true,
              "/Anchor North [rwg]/Forms/Travel Subsidy Request Form.xlsx"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/View.php",
          "line": 1272,
          "function": "emit",
          "class": "OC_Hook",
          "type": "::",
          "args": [
            "OC_Filesystem",
            "write",
            [
              true,
              "/Anchor North [rwg]/Forms/Travel Subsidy Request Form.xlsx"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/View.php",
          "line": 1144,
          "function": "runHooks",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            [
              "update",
              "write"
            ],
            "/Anchor North [rwg]/Forms/Travel Subsidy Request Form.xlsx"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/View.php",
          "line": 680,
          "function": "basicOperation",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            "file_put_contents",
            "/markstock/files/Anchor North [rwg]/Forms/Travel Subsidy Request Form.xlsx",
            [
              "update",
              "write"
            ],
            null
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/Node/File.php",
          "line": 73,
          "function": "file_put_contents",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            "/markstock/files/Anchor North [rwg]/Forms/Travel Subsidy Request Form.xlsx",
            null
          ]
        },
        {
          "file": "/var/www/html/custom_apps/forms/lib/Service/SubmissionService.php",
          "line": 224,
          "function": "putContent",
          "class": "OC\\Files\\Node\\File",
          "type": "->",
          "args": [
            null
          ]
        },
        {
          "file": "/var/www/html/custom_apps/forms/lib/Controller/ApiController.php",
          "line": 1145,
          "function": "writeFileToCloud",
          "class": "OCA\\Forms\\Service\\SubmissionService",
          "type": "->",
          "args": [
            [
              "OCA\\Forms\\Db\\Form",
              246
            ],
            "/Anchor North [rwg]/Forms/Travel Subsidy Request Form.xlsx",
            "xlsx",
            "markstock"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 230,
          "function": "insertSubmission",
          "class": "OCA\\Forms\\Controller\\ApiController",
          "type": "->",
          "args": [
            246,
            [
              [
                "1196"
              ],
              [
                "Ned Evans"
              ],
              [
                "xxx"
              ],
              [
                "2024-07-27"
              ],
              [
                1226
              ],
              "And 12 more entries, set log level to debug to see all entries"
            ],
            "Et49ztRP6TNQT8Qm932qRwcJ"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 137,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            [
              "OCA\\Forms\\Controller\\ApiController"
            ],
            "insertSubmission"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            [
              "OCA\\Forms\\Controller\\ApiController"
            ],
            "insertSubmission"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 315,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Forms\\Controller\\ApiController",
            "insertSubmission",
            [
              "OC\\AppFramework\\DependencyInjection\\DIContainer"
            ],
            [
              "v2.4",
              "ocs.forms.api.insertSubmission"
            ]
          ]
        },
        {
          "file": "/var/www/html/ocs/v1.php",
          "line": 65,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/ocsapp/apps/forms/api/v2.4/submission/insert"
          ]
        },
        {
          "file": "/var/www/html/ocs/v2.php",
          "line": 23,
          "args": [
            "/var/www/html/ocs/v1.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/html/lib/private/Files/View.php",
      "Line": 1128
    },
    "CustomMessage": "Exception thrown: Exception"
  },
  "id": "668c0c4c6935a"
}
Chartman123 commented 4 months ago

Duplicate of #2067