Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using ZnMimePart in Pharo 7.0 throws a "Instance of ZnCharacterStream did not understand #binary" #23

Closed
ioanaverebi opened this issue Sep 26, 2018 · 3 comments

Comments

@ioanaverebi
Copy link

I am performing a request against the Confluence REST API. This request should upload a file using multipart content type. I get the following error when performing the request (this is Pharo 7.0)
screen shot 2018-09-26 at 23 08 57

The code is the following:
`uploadFileFrom: filePath inSpaceWithContentID: contentID
| part pathSegments |
pathSegments := { 'wiki'. 'rest'. 'api'. contentID. 'child'. 'attachment' }.

part := ZnMimePart fieldName: 'file' fileNamed: filePath .
part headers contentType: ZnMimeType default.
part.

ZnClient new
	url: (url asZnUrl addPathSegments: pathSegments yourself);
	username: username password: password;
	headerAt: 'X-Atlassian-Token' put: 'no-check';
	addPart: part;
	post;
	response.`

Any suggestions what the issue might be?

@svenvc
Copy link
Owner

svenvc commented Sep 26, 2018

Yes this was reported before and I already had a look and a fix, but I got stuck somewhere else. I will try to have another look tomorrow.

@svenvc
Copy link
Owner

svenvc commented Sep 27, 2018

Hi,

This should now be fixed in #bleedingEdge (in MC repos) with these versions:

===
Name: Zinc-FileSystem-SvenVanCaekenberghe.18
Author: SvenVanCaekenberghe
Time: 27 September 2018, 2:45:54.976191 pm
UUID: a666ec74-3b33-0d00-a2f9-06800438ffe9
Ancestors: Zinc-FileSystem-SvenVanCaekenberghe.17

add ZnFileSystemUtils #readStreamFor: and #binaryReadStreamFor:

Name: Zinc-HTTP-SvenVanCaekenberghe.476
Author: SvenVanCaekenberghe
Time: 27 September 2018, 2:46:42.96017 pm
UUID: cc90c877-3b33-0d00-a2fa-d50c0438ffe9
Ancestors: Zinc-HTTP-SvenVanCaekenberghe.475

Fix ZnMimePart class>>#fieldName:fileNamed:

Sven

@ioanaverebi
Copy link
Author

Worked like a charm! Thank you Sven!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants