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

Assignments downloading spreadsheet in a site with brackets in its title fails.

    Details

    • 2.9 Status:
      Resolved

      Description

      Here the steps to reproduce the error:

      1.- Create a site with brackets in its name: My [Site]
      2.- Go to assigments and create one a make a submission.
      3.- Try to download submissions as spreadsheet.

      If you take a look at the code in https://source.sakaiproject.org/svn/assignment/trunk/assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java you will see this:

      // a tab title in a workbook have a maximum length of 31 chars.
      // otherwise an Exception will been thrown "Sheet name cannot be blank, greater than 31 chars, or contain any of /*?[]"
      // we truncate it if it's too long
      String sheetTitle = siteTitle;
      int siteTitleLength = sheetTitle.length();
      if (siteTitleLength > 31)

      { M_log.info(this + " Site title is too long (" + siteTitleLength + " chars) truncating it down to 31 chars!"); sheetTitle = sheetTitle.substring(0, 31); }

      HSSFSheet sheet = wb.createSheet(Validator.escapeZipEntry(sheetTitle));

      But escapeZipEntry method obviously filters characters not valid for a ZipEntry, but not for a sheet title. See https://source.sakaiproject.org/svn/kernel/trunk/kernel-util/src/main/java/org/sakaiproject/util/Validator.java

      protected static final String INVALID_CHARS_IN_ZIP_ENTRY = "/\\%:*?'\"";

      So, a new method escapeSheetTitleEntry needed.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ottenhoff Sam Ottenhoff
                  Reporter:
                  jjmerono@um.es Juan José Meroño Sánchez
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code