confluence-go-api icon indicating copy to clipboard operation
confluence-go-api copied to clipboard

Metadata properties are responding with 500 Internal Errors during ContentUpload

Open headincl0ud opened this issue 1 year ago • 1 comments

Describe the bug

Issued code: https://github.com/Virtomize/confluence-go-api/blob/master/content.go#L39 Metadata properties are responding with 500 Internal Errors. With the implementation of Metadata, Confluence is continuously returning 500 errors.

To Reproduce Let's try to configure Metadata in the following way:

		Metadata: &goconfluence.Metadata{
			Properties: &goconfluence.Properties{
				ContentAppearanceDraft: &goconfluence.ContentAppearanceDraft{
					Value: "full-width",
				},
				ContentAppearancePublished: &goconfluence.ContentAppearancePublished{
					Value: "full-width",
				},
			},
		},

Expected behavior The operation - UploadContent should be completed successfully. The Content should be uploaded the response code should be 200 and the layout should be configured for "full-width".

Release version v1.4.4

Additional context Found open-source references: // Commented because Confluence was returned: // '{"statusCode":500,"message":"java.lang.NullPointerException: null"}'

Solution I found the solution to fix the issue with these 500 errors. Based on community comments: https://community.developer.atlassian.com/t/make-layout-full-width-when-creating-page/40461/3 The editor property should be not included in the request.

Even if this property isn't configured, go-confluence is attaching this field with the value: none The solution is to omit/remove this parameter in the request.

Remove -> https://github.com/Virtomize/confluence-go-api/blob/master/content.go#L45 and run the above configuration again to resolve the issue and receive a 200 status code from Confluence.

or: Fix it modifying:

	Editor                     *Editor                     `json:"editor,omitempty"`

headincl0ud avatar Oct 09 '23 11:10 headincl0ud

PR: #60

headincl0ud avatar Oct 09 '23 11:10 headincl0ud