This fixes it, seems it needs the getOriginalName() rather than getName()?

org.apache.struts2.dispatcher.multipart.AbstractMultiPartRequest

original

public String[] getFileNames(String fieldName) {
        return uploadedFiles.getOrDefault(fieldName, Collections.emptyList()).stream()
                .map(file -> getCanonicalName(file.getName()))
                .toArray(String[]::new);
    }

fixed

public String[] getFileNames(String fieldName) {
        return uploadedFiles.getOrDefault(fieldName, Collections.emptyList()).stream()
                .map(file -> getCanonicalName(file.getOriginalName()))
                .toArray(String[]::new);
    }

This .map stuff is not good for debugging🙁.

On 26/02/2024 06:26, Łukasz Lenart wrote:
niedz., 25 lut 2024 o 09:42 Greg Huber<gregh3...@gmail.com>  napisał(a):
Testing the file upload and it now does not work.

I get an error where its using the wrong file name ie
upload5549a568d9794ef5b654da83d079613500000045.tmp rather than the
actual file name.
Which file upload do you use? Old FileuploadInterceptor or
ActionFileuploadInterceptor?
Do you mean the error message is wrong and it displays the wrong file name?

I put back the mods I did, and it still does not work.

Were there any other changes?
Herehttps://github.com/apache/struts/pull/873


Regards
Łukasz

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

Reply via email to