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

content.upload.max=2048 (or greater) will prevent "upload all" from uploading any file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: Assignments
    • Labels:
      None
    • Environment:
      32-bit java

      Description

      if you set content.upload.max = 2048 or greater, then doUpload_all_upload routine will incorrectly compute max_bytes and cause "upload all" to always generate an alert that "The upload size limit of X MB has been exceeded".

      In assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java :

      public void doUpload_all_upload(RunData data)
      {

      :
      String max_file_size_mb = ServerConfigurationService.getString("content.upload.max", "1");
      int max_bytes = 1024 * 1024;
      try

      { max_bytes = Integer.parseInt(max_file_size_mb) * 1024 * 1024; }

      ;

      for content.upload.max = 2048

      max_bytes = 2048 * 1024 * 1024 = 2,147,483,648 (or 2^32)

      however, max int in 32-bit java is 2^31-1 = 2,147,483,647

      when you store 2^32 in int, you get -2,147,483,648

      which causes the check condition to always fail:

      if (fileData.length >= max_bytes)

      { addAlert(state, rb.getString("uploadall.size") + " " + max_file_size_mb + "MB " + rb.getString("uploadall.exceeded")); }

      and generate the alert

      "The upload size limit of X MB has been exceeded".

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  zqian Zhen Qian
                  Reporter:
                  ian.goh@jhu.edu Ian Goh (Inactive)
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration