tables icon indicating copy to clipboard operation
tables copied to clipboard

Creating new application breaks without Icon

Open cwerstuik opened this issue 2 months ago • 3 comments

Steps to reproduce

  1. Create new application
  2. Fill out info, but don't change icon
  3. Click "Create Application"

Expected behavior

Application is created without errors

Actual behavior

Page goes blank and a couple errors appear saying, "Could not create new table" and "Could not insert application. Unknown error."

Everything works fine when a app icon is manually selected. This is a quick copy/paste from my browser console:

It's sending {"name":"test","iconName":{},"description":"test","nodes":[{"id":9,"type":0,"permissions":7}]}

And receiving Internal Server Error\nOCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100

code: "ERR_BAD_RESPONSE"
​
config: Object { timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", … }
​​
adapter: Array [ "xhr", "http" ]
​​
data: '{"name":"test","iconName":{},"description":"test","nodes":[{"id":9,"type":0,"permissions":7}]}'
​​
env: Object { FormData: (), Blob: () }
​​
headers: Object { Accept: "application/json, text/plain, */*", "Content-Type": "application/json", requesttoken: "ko57IushNwmUi42OxKWsvP16R5Bk4zcxbx+0EcLBikU=:ueAUCZpFAGOi4N678JeZ6Ik3N6Mjp05DLmvsfPCP+HU=" }
​​
maxBodyLength: -1
​​
maxContentLength: -1
​​
method: "post"
​​
timeout: 0
​​
transformRequest: Array [ transformRequest(e, t)
 ]
​​
transformResponse: Array [ transformResponse(e)
 ]
​​
transitional: Object { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }
​​
url: "https://***/ocs/v2.php/apps/tables/api/2/contexts"
​​
validateStatus: function validateStatus(e)
​​
xsrfCookieName: "XSRF-TOKEN"
​​
xsrfHeaderName: "X-XSRF-TOKEN"
​​
<prototype>: Object { … }
​
message: "Request failed with status code 500"
​
name: "AxiosError"
​
request: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
​
response: Object { data: `<?xml version="1.0"?>\n<ocs>\n <meta>\n  <status>failure</status>\n  <statuscode>500</statuscode>\n  <message>Internal Server Error\nOCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100</message>\n </meta>\n <data/>\n</ocs>\n`, status: 500, statusText: "", … }
​​
config: Object { timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", … }
​​
data: `<?xml version="1.0"?>\n<ocs>\n <meta>\n  <status>failure</status>\n  <statuscode>500</statuscode>\n  <message>Internal Server Error\nOCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100</message>\n </meta>\n <data/>\n</ocs>\n`
​​
headers: Object { "cache-control": "no-store, no-cache, must-revalidate", "content-length": "444", "content-security-policy": "default-src 'self'; script-src 'self' 'nonce-cjR4YlNZSmo4c2Z4VUgxSGZ5K0JWZC9QN1B4cWZzb2NZLzlua1NBRGtZOD06aE9JMFl2TUh4YTNIT3k1eVN4MjBBYXVDbk04dE9yTnVJb3MvL0JKTjQ3OD0='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';", … }
​​
request: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
​​
status: 500
​​
statusText: ""

And here is the log file error:

{
	"reqId": "MZRcpYI4bHPXR4mhpljG",
	"level": 3,
	"time": "2024-04-29T21:14:31+00:00",
	"remoteAddr": "******",
	"user": "*******",
	"app": "no app in context",
	"method": "POST",
	"url": "/ocs/v2.php/apps/tables/api/2/contexts",
	"message": "OCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100",
	"userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0",
	"version": "29.0.0.19",
	"exception": {
		"Exception": "Exception",
		"Message": "OCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100",
		"Code": 0,
		"Trace": [{
			"file": "/var/www/html/lib/private/AppFramework/App.php",
			"line": 184,
			"function": "dispatch",
			"class": "OC\\AppFramework\\Http\\Dispatcher",
			"type": "->",
			"args": [
				["OCA\\Tables\\Controller\\ContextController"], "create"
			]
		}, {
			"file": "/var/www/html/lib/private/Route/Router.php",
			"line": 338,
			"function": "main",
			"class": "OC\\AppFramework\\App",
			"type": "::",
			"args": ["OCA\\Tables\\Controller\\ContextController", "create", ["OC\\AppFramework\\DependencyInjection\\DIContainer"],
				["ocs.tables.context.create"]
			]
		}, {
			"file": "/var/www/html/ocs/v1.php",
			"line": 66,
			"function": "match",
			"class": "OC\\Route\\Router",
			"type": "->",
			"args": ["/ocsapp/apps/tables/api/2/contexts"]
		}, {
			"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": 170,
		"Previous": {
			"Exception": "TypeError",
			"Message": "OCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232",
			"Code": 0,
			"Trace": [{
				"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
				"line": 232,
				"function": "create",
				"class": "OCA\\Tables\\Controller\\ContextController",
				"type": "->",
				"args": ["*** sensitive parameters replaced ***"]
			}, {
				"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
				"line": 138,
				"function": "executeController",
				"class": "OC\\AppFramework\\Http\\Dispatcher",
				"type": "->",
				"args": [
					["OCA\\Tables\\Controller\\ContextController"], "create"
				]
			}, {
				"file": "/var/www/html/lib/private/AppFramework/App.php",
				"line": 184,
				"function": "dispatch",
				"class": "OC\\AppFramework\\Http\\Dispatcher",
				"type": "->",
				"args": [
					["OCA\\Tables\\Controller\\ContextController"], "create"
				]
			}, {
				"file": "/var/www/html/lib/private/Route/Router.php",
				"line": 338,
				"function": "main",
				"class": "OC\\AppFramework\\App",
				"type": "::",
				"args": ["OCA\\Tables\\Controller\\ContextController", "create", ["OC\\AppFramework\\DependencyInjection\\DIContainer"],
					["ocs.tables.context.create"]
				]
			}, {
				"file": "/var/www/html/ocs/v1.php",
				"line": 66,
				"function": "match",
				"class": "OC\\Route\\Router",
				"type": "->",
				"args": ["/ocsapp/apps/tables/api/2/contexts"]
			}, {
				"file": "/var/www/html/ocs/v2.php",
				"line": 23,
				"args": ["/var/www/html/ocs/v1.php"],
				"function": "require_once"
			}],
			"File": "/var/www/html/custom_apps/tables/lib/Controller/ContextController.php",
			"Line": 100
		},
		"message": "OCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100",
		"exception": [],
		"CustomMessage": "OCA\\Tables\\Controller\\ContextController::create(): Argument #2 ($iconName) must be of type string, array given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 232 in file '/var/www/html/custom_apps/tables/lib/Controller/ContextController.php' line 100"
	},
	"id": "66301375adae7"
}

Tables app version

0.7.1

Browser

Firefox

Client operating system

Linux

Operating system

Linux

Web server

Apache

PHP engine version

PHP 8.2

Database

MySQL

Additional info

No response

cwerstuik avatar Apr 29 '24 21:04 cwerstuik

This should be solved in 0.7.1. Can you try deleting your browser cache?

blizzz avatar Apr 30 '24 07:04 blizzz

I've tried deleting the cache in all the ways that usually work and it's still coming up with this error. I even just tried to completely delete and redownload tables and still has the error

cwerstuik avatar Apr 30 '24 16:04 cwerstuik

OK actually we missed a backport. https://github.com/nextcloud/tables/pull/1041 will fix it.

blizzz avatar Apr 30 '24 18:04 blizzz

Should be fixed now? @cwerstuik

enjeck avatar May 06 '24 10:05 enjeck

Sorry, I've been on the road, and won't be able to try out the fix until Friday

cwerstuik avatar May 07 '24 02:05 cwerstuik

Today's 0.7.2 release ships the fix.

blizzz avatar May 08 '24 16:05 blizzz