microsoftgraph / microsoftgraph/msgraph-sdk-go

Upload app logo resulted in Error

Open
#745 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
335
Forks
43
Avg merge
15h 19m
Merged PRs (30d)
3

Description

Using the below code to upload an Logo for a given App:

headers := abstractions.NewRequestHeaders()
	headers.Add("Content-Type", "image/jpg")
	configuration := &applications.
		ItemLogoRequestBuilderPutRequestConfiguration{
		Headers: headers,
	}
	appLogo, err := os.ReadFile(appLogoFile)
	resp, err := client.Applications().ByApplicationId(appObjectID).Logo().Put(
		ctx,
		appLogo,
		configuration,
	)

However this results in the below error:
content type text/html does not have a factory registered to be parsed
On debugging further it was found that the APi call results in a a Bad Request 400 erro and the same is getting set in response body resulting in above error.
Looks like Content-tye is set to 2 values image/jpeg and application/octet-stream . Not sure if this is causeing the request to the MS graph API to fail

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Applications().ByApplicationId(...).Logo().Put entry point and reproduce the request with the headers and image data shown. Inspect the outgoing Content-Type values and the Microsoft Graph 400 response, then verify the upload succeeds without the text/html parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.