Skip to content

Conversation

@blizzz
Copy link
Member

@blizzz blizzz commented Jan 21, 2025

  • a plain response is instantiated in two places
  • solves a PHP Error

Cf. lines 336 and 342 for the instantiation.

This prevents me opening documents for editing on 31.

Uncaught error: OCA\\Richdocuments\\Controller\\WopiController::getFile(): Return value must be of type OCP\\AppFramework\\Http\\JSONResponse|OCP\\AppFramework\\Http\\StreamResponse, OCP\\AppFramework\\Http\\Response returned in file '/path/to/nextcloud/apps/richdocuments/lib/Controller/WopiController.php' line 374
{
  "reqId": "SDJcMq8QHM71UZdi9KYd",
  "level": 3,
  "time": "2025-01-21T19:28:49+00:00",
  "remoteAddr": "127.0.0.1",
  "user": false,
  "app": "richdocuments",
  "method": "GET",
  "url": "/master/index.php/apps/richdocuments/wopi/files/1005358_oc1aiufaw3gw/contents?access_token=larf2GHV7ApYlYKHmaXU713jocMSZlz7&access_token_ttl=0",
  "message": "Uncaught error: OCA\\Richdocuments\\Controller\\WopiController::getFile(): Return value must be of type OCP\\AppFramework\\Http\\JSONResponse|OCP\\AppFramework\\Http\\StreamResponse, OCP\\AppFramework\\Http\\Response returned in file '/path/to/nextcloud/apps/richdocuments/lib/Controller/WopiController.php' line 374",
  "userAgent": "COOLWSD HTTP Agent 24.04.7.1",
  "version": "31.0.0.9",
  "exception": {
    "Exception": "Exception",
    "Message": "OCA\\Richdocuments\\Controller\\WopiController::getFile(): Return value must be of type OCP\\AppFramework\\Http\\JSONResponse|OCP\\AppFramework\\Http\\StreamResponse, OCP\\AppFramework\\Http\\Response returned in file '/path/to/nextcloud/apps/richdocuments/lib/Controller/WopiController.php' line 374",
    "Code": 0,
    "Trace": [
      {
        "file": "/path/to/nextcloud/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Richdocuments\\Controller\\WopiController"
          },
          "getFile"
        ]
      },
      {
        "file": "/path/to/nextcloud/lib/private/Route/Router.php",
        "line": 306,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Richdocuments\\Controller\\WopiController",
          "getFile",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "fileId": "1005358_oc1aiufaw3gw",
            "_route": "richdocuments.wopi.getfile"
          }
        ]
      },
      {
        "file": "/path/to/nextcloud/lib/base.php",
        "line": 1019,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/richdocuments/wopi/files/1005358_oc1aiufaw3gw/contents"
        ]
      },
      {
        "file": "/path/to/nextcloud/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/path/to/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 146,
    "Previous": {
      "Exception": "TypeError",
      "Message": "OCA\\Richdocuments\\Controller\\WopiController::getFile(): Return value must be of type OCP\\AppFramework\\Http\\JSONResponse|OCP\\AppFramework\\Http\\StreamResponse, OCP\\AppFramework\\Http\\Response returned",
      "Code": 0,
      "Trace": [
        {
          "file": "/path/to/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 200,
          "function": "getFile",
          "class": "OCA\\Richdocuments\\Controller\\WopiController",
          "type": "->",
          "args": [
            "1005358",
            "larf2GHV7ApYlYKHmaXU713jocMSZlz7"
          ]
        },
        {
          "file": "/path/to/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 114,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Richdocuments\\Controller\\WopiController"
            },
            "getFile"
          ]
        },
        {
          "file": "/path/to/nextcloud/lib/private/AppFramework/App.php",
          "line": 161,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Richdocuments\\Controller\\WopiController"
            },
            "getFile"
          ]
        },
        {
          "file": "/path/to/nextcloud/lib/private/Route/Router.php",
          "line": 306,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Richdocuments\\Controller\\WopiController",
            "getFile",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "fileId": "1005358_oc1aiufaw3gw",
              "_route": "richdocuments.wopi.getfile"
            }
          ]
        },
        {
          "file": "/path/to/nextcloud/lib/base.php",
          "line": 1019,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/richdocuments/wopi/files/1005358_oc1aiufaw3gw/contents"
          ]
        },
        {
          "file": "/path/to/nextcloud/index.php",
          "line": 24,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/path/to/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
      "Line": 374
    },
    "message": "Uncaught error: OCA\\Richdocuments\\Controller\\WopiController::getFile(): Return value must be of type OCP\\AppFramework\\Http\\JSONResponse|OCP\\AppFramework\\Http\\StreamResponse, OCP\\AppFramework\\Http\\Response returned in file '/path/to/nextcloud/apps/richdocuments/lib/Controller/WopiController.php' line 374",
    "exception": {},
    "CustomMessage": "Uncaught error: OCA\\Richdocuments\\Controller\\WopiController::getFile(): Return value must be of type OCP\\AppFramework\\Http\\JSONResponse|OCP\\AppFramework\\Http\\StreamResponse, OCP\\AppFramework\\Http\\Response returned in file '/path/to/nextcloud/apps/richdocuments/lib/Controller/WopiController.php' line 374"
  }
}

- a plain response is instantiated in two places
- solves a PHP Error

Signed-off-by: Arthur Schiwon <[email protected]>
@blizzz blizzz added bug Something isn't working 3. to review Ready to be reviewed labels Jan 21, 2025
@blizzz
Copy link
Member Author

blizzz commented Jan 21, 2025

Best guess for composer: the workflow runs with 2.8.5, while at least I have 2.8.4 locally, and with that i cannot repro the issue. Apart of that one reference thing i committed.

Alas, i fetched 2.8.5 and could not reproduce it either. Maybe i need to switch to PHP 8.1? But should not need to?

@elzody
Copy link
Contributor

elzody commented Jan 23, 2025

/backport to stable31

@elzody elzody merged commit 82b0e9b into main Jan 23, 2025
72 of 73 checks passed
@elzody elzody deleted the fix/noid/getfile-responsetype branch January 23, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Ready to be reviewed bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants