Skip to content

Commit

Permalink
SAK-44477 File naming when compressing top-level folder (sakaiproject…
Browse files Browse the repository at this point in the history
…#8698)

It seems this attributte had a wrong value since the early times,
probably not used elsewhere though
  • Loading branch information
bgarciaentornos authored Oct 22, 2020
1 parent 7bd1877 commit 6a8970b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ public String buildMoreContext ( VelocityPortlet portlet,
context.put ("id", entityId);
String collectionId = (String) state.getAttribute(STATE_MORE_COLLECTION_ID);
context.put ("collectionId", collectionId);
String homeCollectionId = (String) (String) state.getAttribute (STATE_HOME_COLLECTION_ID);
String homeCollectionId = (String) state.getAttribute (STATE_HOME_COLLECTION_ID);
context.put("homeCollectionId", homeCollectionId);
//List cPath = getCollectionPath(state);
//context.put ("collectionPath", cPath);
Expand Down Expand Up @@ -8350,11 +8350,11 @@ else if(RESOURCES_MODE_DROPBOX.equals(resources_mode))
if ((home == null) || (home.length() == 0))
{
home = contentHostingService.getSiteCollection(toolManager.getCurrentPlacement().getContext());

// TODO: what's the 'name' of the context? -ggolden
// we'll need this to create the home collection if needed
state.setAttribute (STATE_HOME_COLLECTION_DISPLAY_NAME, toolManager.getCurrentPlacement().getContext()
/*siteService.getSiteDisplay(toolManager.getCurrentPlacement().getContext()) */);
try {
state.setAttribute(STATE_HOME_COLLECTION_DISPLAY_NAME, ((Site) siteService.getSite(toolManager.getCurrentPlacement().getContext())).getTitle());
} catch (IdUnusedException e) {
log.warn("Error while trying to set {} attribute for site {}", STATE_HOME_COLLECTION_DISPLAY_NAME, toolManager.getCurrentPlacement().getContext());
}
}
}
state.setAttribute (STATE_HOME_COLLECTION_ID, home);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,12 @@ public void compressFolder(Reference reference) {
String resourceName = extractName(resourceId);
String homeCollectionId = (String) toolSession.getAttribute(STATE_HOME_COLLECTION_ID);
if(homeCollectionId != null && homeCollectionId.equals(reference.getId())){
//place the zip file into the home folder of the resource tool
resourceId = reference.getId() + resourceName;

String homeName = (String) toolSession.getAttribute(STATE_HOME_COLLECTION_DISPLAY_NAME);
if(homeName != null){
resourceName = homeName;
}
resourceName = homeName + ZIP_EXTENSION;
}
//place the zip file into the home folder of the resource tool
resourceId = reference.getId() + homeName;
}
int count = 0;
ContentResourceEdit resourceEdit = null;
Expand Down

0 comments on commit 6a8970b

Please sign in to comment.