ocis icon indicating copy to clipboard operation
ocis copied to clipboard

Some request on `/app/open` endpoint returns `500` status code

Open PrajwolAmatya opened this issue 6 months ago • 1 comments

Describe the bug

  1. Sending POST request on the /app/open/ endpoint for text file without app_name query parameter, returns 500 status code.

  2. We get the same response when requesting with unsupported file formats and for the endpoints:

    • /app/open?file_id={file_id}
    • /app/open?file_id={file_id}&app_name=FakeOffice
    • /app/open-with-web?file_id={file_id}
    • /app/open-with-web?file_id={file_id}&app_name=FakeOffice

Steps to reproduce

  1. Create a text file textfile.txt
  2. Send POST request
curl -kv -XPOST -ueinstein:relativity "https://host.docker.internal:9200/app/open?file_id={file_id}" | jq

We get the following response:

< HTTP/1.1 500 Internal Server Error
< Content-Length: 134
< Content-Security-Policy: child-src 'self'; connect-src 'self' https://raw.githubusercontent.com/owncloud/awesome-ocis/; default-src 'none'; font-src 'self'; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/ http://host.docker.internal:8080/; img-src 'self' data: blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/ http://host.docker.internal:8080/; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'
< Content-Type: application/json
< Date: Wed, 28 Aug 2024 04:52:49 GMT
< Referrer-Policy: strict-origin-when-cross-origin
< Strict-Transport-Security: max-age=315360000; preload
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Request-Id: 1e726966028a/3wKHavZGzb-000286
< X-Robots-Tag: none
< X-Xss-Protection: 1; mode=block
< 
{ [134 bytes data]
100   134  100   134    0     0   4262      0 --:--:-- --:--:-- --:--:--  4322
* Connection #0 to host host.docker.internal left intact
{
  "code": "SERVER_ERROR",
  "message": "Error contacting the requested application, please use a different one or try again later"
}

Expected behavior

The error message seems fine, but the status code can be 503 indicating Service is unavailable.

Actual behavior

The response returns 500 status code which indicates internal Server Error.

cc @jvillafanez

PrajwolAmatya avatar Aug 28 '24 05:08 PrajwolAmatya