Skip to content

Commit

Permalink
SAK-32588 Allow uploads without dots in name (sakaiproject#4468)
Browse files Browse the repository at this point in the history
* SAK-32588 Allow uploads without dots in name.

This allows the upload to work sensibly when there isn’t a dot in the filename.

* Stop logging warnings when things don’t exist.

If the resources tool has been added to the site but the root collection for the site hasn’t yet been created  elfinder will attempt to discover information about a collection that doesn’t exist. This would result in lots of stack traces that aren’t serious so we now ignore them.
  • Loading branch information
buckett authored Jun 9, 2017
1 parent 7908335 commit 68011a2
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void createFile(FsItem fsi) throws IOException {
String id = asId(fsi);
try {
String filename = lastPathSegment(id);
String name = "", ext = "";
String name = filename, ext = "";
int index = filename.lastIndexOf(".");
if (index >= 0) {
name = filename.substring(0, index);
Expand Down Expand Up @@ -213,6 +213,8 @@ public long getLastModified(FsItem fsi) {
}
Date date = contentEntity.getProperties().getDateProperty(ResourceProperties.PROP_MODIFIED_DATE);
return date.getTime() / 1000;
} catch (IdUnusedException iue) {
LOG.debug("Failed to find item to get last modified date for: "+ id);
} catch (SakaiException se) {
LOG.warn("Failed to get last modified date for: " + id, se);
} catch (EntityPropertyTypeException e) {
Expand Down Expand Up @@ -262,6 +264,8 @@ public String getName(FsItem fsi) {
contentEntity = contentHostingService.getResource(id);
}
return contentEntity.getProperties().getProperty(ResourceProperties.PROP_DISPLAY_NAME);
} catch (IdUnusedException iue) {
LOG.debug("Failed to find item to get name: "+ id);
} catch (SakaiException se) {
LOG.warn("Failed to get name for: " + id, se);
}
Expand Down Expand Up @@ -302,6 +306,8 @@ public long getSize(FsItem fsi) {
} else {
return contentHostingService.getResource(id).getContentLength();
}
} catch (IdUnusedException uie) {
LOG.debug("Failed to file size as item can't be found: "+ id);
} catch (SakaiException se) {
LOG.warn("Failed to get size for: " + id, se);
}
Expand All @@ -324,9 +330,12 @@ public boolean hasChildFolder(FsItem fsi) {
return true;
}
}
} catch (IdUnusedException iue) {
LOG.debug("Couldn't find resource to look for child folders: "+ id);
} catch (SakaiException se) {
LOG.warn("Couldn't is if there are child folders: " + id, se);
LOG.warn("Couldn't see if there are child folders: " + id, se);
}

return false;
}

Expand All @@ -351,6 +360,8 @@ public FsItem[] listChildren(FsItem fsi) {
items.add(fromPath(member));
}
return items.toArray(new FsItem[items.size()]);
} catch (IdUnusedException iue) {
LOG.debug("Failed to list children as item can't be found for: "+ id);
} catch (PermissionException pe) {
throw new ErrorException("errPerm");
} catch (SakaiException se) {
Expand Down

0 comments on commit 68011a2

Please sign in to comment.