struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (Jira)" <j...@apache.org>
Subject [jira] [Work logged] (WW-5088) Empty file upload gives wrong error message
Date Tue, 13 Oct 2020 21:51:00 GMT

     [ https://issues.apache.org/jira/browse/WW-5088?focusedWorklogId=500306&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-500306
]

ASF GitHub Bot logged work on WW-5088:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Oct/20 21:50
            Start Date: 13/Oct/20 21:50
    Worklog Time Spent: 10m 
      Work Description: coveralls commented on pull request #440:
URL: https://github.com/apache/struts/pull/440#issuecomment-708028689


   
   [![Coverage Status](https://coveralls.io/builds/34150972/badge)](https://coveralls.io/builds/34150972)
   
   Coverage decreased (-0.0008%) to 49.779% when pulling **4bf05d288cfbac9106db88ebd7312801111c25ba
on pys-arhs:feature/WW-5088** into **b180eaa57d9bfc308d98882720648936f2dcb38f on apache:master**.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 500306)
    Time Spent: 1h 10m  (was: 1h)

> Empty file upload gives wrong error message
> -------------------------------------------
>
>                 Key: WW-5088
>                 URL: https://issues.apache.org/jira/browse/WW-5088
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.5.22
>            Reporter: Greg Huber
>            Priority: Minor
>             Fix For: 2.6
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> On an empty file upload the storeLocation is null, so adds a file new StrutsUploadedFile(null)
> JakartaMultiPartRequest
> {code:java}
> List fileList = new ArrayList<>(items.size());
> for (FileItem fileItem : items) {
> File storeLocation = ((DiskFileItem) fileItem).getStoreLocation();
> if (fileItem.isInMemory() && storeLocation != null && !storeLocation.exists())
{
> try {
> storeLocation.createNewFile();
> } catch (IOException e) {
> LOG.error("Cannot write uploaded empty file to disk: {}", storeLocation.getAbsolutePath(),
e);
> }
> }
> fileList.add(new StrutsUploadedFile(storeLocation));
> }
> {code}
> The FileUploadInterceptor checks for a null file but not null content from the new StrutsUploadedFile(null).
> eg for an empty file main.js
> Error message should be:
> Error uploading: main.js
> but gives:
> Error setting expression 'uploadedFiles' with value ['org.apache.struts2.dispatcher.multipart.StrutsUploadedFile@202585bc',
]
> Error setting expression 'uploadedFiles' with value ['org.apache.struts2.dispatcher.multipart.StrutsUploadedFile@49553150',
]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message