Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-43666

Files over 2G have incorrect file size

    XMLWordPrintable

    Details

    • 20 status:
      Resolved
    • 19 status:
      Resolved
    • 12 status:
      Verified
    • Test Plan:
      Hide

      Upload a file larger than 2G via webdav or Resources.

      Verify that the file size is shown correctly in Resources.

      Show
      Upload a file larger than 2G via webdav or Resources. Verify that the file size is shown correctly in Resources.

      Description

      Files uploaded via WebDAV and probably Resources get an incorrect content-length, because of the use of org.springframework.util.FileCopyUtils.copy() which returns an int size.

      Broken in 12.x and also looks broken in master though can't test directly on qa2 because of an nginx policy.

       # diff -u /usr/local/src/vula_src/branches/vula-12.x/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DefaultFileSystemHandler.java  kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DefaultFileSystemHandler.java 
      --- /usr/local/src/vula_src/branches/vula-12.x/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DefaultFileSystemHandler.java	2018-01-05 11:44:22.000000000 +0200
      +++ kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DefaultFileSystemHandler.java	2020-05-17 12:07:31.642811437 +0200
      @@ -24,7 +24,7 @@
       import java.io.InputStream;
       import java.net.URI;
       
      -import org.springframework.util.FileCopyUtils;
      +import org.apache.commons.io.IOUtils;
       
       /**
        * The default implementation of FileSystemHandler, targeting local disk.
      @@ -93,7 +93,7 @@
               }
       
               // write the file
      -        return FileCopyUtils.copy(stream, new FileOutputStream(file));
      +        return IOUtils.copyLarge(stream, new FileOutputStream(file));
           }
       
           @Override
      
      

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                smarquard Stephen Marquard
                Reporter:
                smarquard Stephen Marquard
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration