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

BatchUpload overly restrictive regarding Blob Filename #92

Closed
osx2000 opened this issue Aug 17, 2020 · 1 comment · Fixed by #93
Closed

BatchUpload overly restrictive regarding Blob Filename #92

osx2000 opened this issue Aug 17, 2020 · 1 comment · Fixed by #93

Comments

@osx2000
Copy link

osx2000 commented Aug 17, 2020

When trying to upload a file, using the batch upload, with a filename containing characters outside Ascii Hex [20,1E] , the Nuxeo Client throws an exception and the content ist not transmitted.

Here is the stack trace:

java.lang.IllegalArgumentException: Unexpected char 0xdc at 0 in X-File-Name value: Ümlaut.pdf
	at okhttp3.Headers.checkValue(Headers.java:284)
	at okhttp3.Headers$Builder.add(Headers.java:324)
	at okhttp3.Request$Builder.addHeader(Request.java:196)
	at retrofit2.RequestBuilder.addHeader(RequestBuilder.java:101)
	at retrofit2.ParameterHandler$Header.apply(ParameterHandler.java:79)
	at retrofit2.RequestFactory.create(RequestFactory.java:108)
	at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:190)
	at retrofit2.OkHttpCall.execute(OkHttpCall.java:173)
	at org.nuxeo.client.NuxeoClient.fetchResponse(NuxeoClient.java:274)
	at org.nuxeo.client.objects.AbstractConnectable.fetchResponse(AbstractConnectable.java:65)
	at org.nuxeo.client.objects.upload.BatchUpload.upload(BatchUpload.java:169)
	at xxx.NuxeoAccess.testBatchUpload(NuxeoAccess.java:67)

The okhttp.checkValue method throws because it checks every char c of filename like this ((c <= '\u001f' && c != '\t') || c >= '\u007f')

There is relevant discussion about that (overly restrictive) okhttp behaviour here: square/okhttp#2016 , especially square/okhttp#2016 (comment) - and okhttp offers https://square.github.io/okhttp/4.x/okhttp/okhttp3/-headers/-builder/add-unsafe-non-ascii/ to work around this.

So, I'd like to store Files in Nuxeo with filenames containing, for example, umlauts - basically every character that's supported in modern filesystem filenames - which seems as a rather unsurprising requirement for a content management system like Nuxeo.

But It seems I can't use the current BatchUpload API to achieve this.

Is that correct? Have you encountered this before?

@kevinleturc
Copy link
Member

Hello,

We've never encountered this, but I agree with you, the client should handle this kind of character.

I created JAVACLIENT-208 to tackle this.

Thanks.

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

Successfully merging a pull request may close this issue.

2 participants