Index: lams_build/lib/lams/lams-contentrepository.jar =================================================================== diff -u -ra93d8d1f7b86194a155d41c34874fc83acada0c9 -r6d9f76784c1cf0006c118d74c1757ed8aa2032a4 Binary files differ Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/IVersionedNode.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r6d9f76784c1cf0006c118d74c1757ed8aa2032a4 --- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/IVersionedNode.java (.../IVersionedNode.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/IVersionedNode.java (.../IVersionedNode.java) (revision 6d9f76784c1cf0006c118d74c1757ed8aa2032a4) @@ -167,6 +167,18 @@ public String getPath() ; /** + * Get zip compatible filename/path. + * + * There are problems with zipping up files where the names are UTF-8 names - depending on what platform + * and what zip utility you are using, the filename may be corrupted. To avoid this, we can produce a filename (and + * path) where the normal "names" are replaced with the uuid but the extension is kept. This will allow downloaded + * files to be opened by their applications + * + * @return a file path (from parent) or filename that may be used for naming a file put in a zip archive. + */ + public String getZipCompatiblePath() ; + + /** * Get the ticket through which this node was accessed. * * @return A (@link ITicket} object. Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/service/SimpleVersionedNode.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r6d9f76784c1cf0006c118d74c1757ed8aa2032a4 --- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/service/SimpleVersionedNode.java (.../SimpleVersionedNode.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/service/SimpleVersionedNode.java (.../SimpleVersionedNode.java) (revision 6d9f76784c1cf0006c118d74c1757ed8aa2032a4) @@ -268,6 +268,43 @@ } /** + * @see org.lamsfoundation.lams.contentrepository.IVersionedNode#getZipCompatiblePath() + */ + public String getZipCompatiblePath() { + nodeObjectInitilised("Unable to get path."); + String path = node.getPath(); + if ( path == null ) { + return null; + } else { + String uuidString = node.getNodeId().toString(); + + path = path.trim(); + int dotPos = path.lastIndexOf("."); + String extension = dotPos >= 0 ? path.substring(dotPos + 1, path.length()) : null; + + // convert each section of the path to the number + // should try to handle funny paths like ones with leading or trailing slashes + String modified = ""; + if ( path.startsWith("/") ) { + modified = "/" + modified; + path = path.substring(1,path.length()); + } + + String[] pathParts = path.split("[/]+"); + for ( int i=0; i