Hi!

Are you sure you have UTF-8 encoding end-to-end (so for Java, and for OS)?

https://stackoverflow.com/questions/39185613/java-nio-file-invalidpathexception-malformed-input-or-input-contains-unmappable


My first guess is you have a charset active/set either for java or the OS
which does not support umlauts.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 20 november 2024 bij 13:22:19, Per Newgro (per.new...@gmx.ch.invalid)
schreef:

Hi,

i would like to upload a file that is named "Schmutzfänger Offroad hinten
202443 und -444.JPG" in my local Windows Filesystem.
My app running in a cluster on a Linux image produces this exception.

<pre>Unexpected error occurred
java.nio.file.InvalidPathException: Malformed input or input contains
unmappable characters: Schmutzfänger Offroad hinten 202443 und -444.JPG
at java.base/sun.nio.fs.UnixPath.encode(Unknown Source)
at java.base/sun.nio.fs.UnixPath.<init>(Unknown Source)
at java.base/sun.nio.fs.UnixFileSystem.getPath(Unknown Source)
at java.base/java.nio.file.Path.of(Unknown Source)
at java.base/java.nio.file.Paths.get(Unknown Source)
at
org.apache.commons.fileupload2.core.DiskFileItem.checkFileName(DiskFileItem.java:165)

at
org.apache.commons.fileupload2.core.FileItemInputImpl.getName(FileItemInputImpl.java:179)

at
org.apache.commons.fileupload2.core.AbstractFileUpload.lambda$parseRequest$1(AbstractFileUpload.java:473)

at
org.apache.commons.io.function.IOIterator.forEachRemaining(IOIterator.java:65)

at
org.apache.commons.fileupload2.core.AbstractFileUpload.parseRequest(AbstractFileUpload.java:462)

at
org.apache.wicket.protocol.http.servlet.MultipartServletWebRequestImpl.parseFileParts(MultipartServletWebRequestImpl.java:189)

at org.apache.wicket.markup.html.form.Form.handleMultiPart(Form.java:1494)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:812)
at org.apache.wicket.markup.html.form.Form.onRequest(Form.java:760)
[...]
</init></pre>

Here is a small code snippet showing our current "setup"
<code>
MyPage() {
Form&lt;&gt; form;
add(form = new Form&lt;&gt;("form", model);
form.setMultiPart(true);
form.add(new FileUploadField("uploadMedium", PropertyModel.of(model,
"fileUpload"));
}
</code>

When we commit the form, the exception is thrown.

What is a good way to make file upload possible, with these type of
filenames?
Do i really have to overwrite FileUpload.getClientFileName? Maybe we can
setup
something completely different?

Thanks for your support
Regards
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to