From: <mol...@us...> - 2009-08-26 10:58:29
|
Revision: 1313 http://openutils.svn.sourceforge.net/openutils/?rev=1313&view=rev Author: molaschi Date: 2009-08-26 10:58:20 +0000 (Wed, 26 Aug 2009) Log Message: ----------- MEDIA-10 set current node path as base path to explode zip file Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2009-08-25 16:16:27 UTC (rev 1312) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2009-08-26 10:58:20 UTC (rev 1313) @@ -104,13 +104,16 @@ public String saveZip() { + InputStream zipStream = null; try { - HierarchyManager mgr = MgnlContext.getSystemContext().getHierarchyManager(MediaModule.REPO); File temp = File.createTempFile("zipmedia", ".zip"); FileOutputStream fos = new FileOutputStream(temp); - IOUtils.copy(zipFile.getStream(), fos); - fos.close(); + + zipStream = zipFile.getStream(); + IOUtils.copy(zipStream, fos); + + IOUtils.closeQuietly(fos); ZipFile zip = new ZipFile(temp); Enumeration< ? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) @@ -118,42 +121,47 @@ ZipEntry entry = entries.nextElement(); String path = entry.getName(); - path = StringUtils.replace(path, "\\", "/"); - if (!path.startsWith("/")) - { - path = "/" + path; - } - if (path.endsWith("/")) - { - path = path.substring(0, path.length() - 1); - } if (!entry.isDirectory()) { InputStream inputStream = zip.getInputStream(entry); - String parent = StringUtils.substringBeforeLast(path, "/"); - String filename = StringUtils.substringAfterLast(path, "/"); + String parent = StringUtils.trimToEmpty(parentPath) + "/" + path; + parent = StringUtils.replace(parent, "\\", "/"); + parent = StringUtils.replace(parent, "//", "/"); + if (!parent.startsWith("/")) + { + parent = "/" + parent; + } + String filename = StringUtils.substringAfterLast(parent, "/"); + parent = StringUtils.substringBeforeLast(parent, "/"); - MediaLoadUtils.loadEntry(inputStream, StringUtils.defaultIfEmpty(parent, "/"), filename, false); + MediaLoadUtils.loadEntry( + inputStream, + StringUtils.defaultIfEmpty(parent, "/fromzip"), + filename, + false); } - } } catch (IOException e) { - + log.error(e.getMessage(), e); } catch (AccessDeniedException e) { - + log.error(e.getMessage(), e); } catch (RepositoryException e) { - + log.error(e.getMessage(), e); } + finally + { + IOUtils.closeQuietly(zipStream); + } this.openPath = parentPath; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 13:58:59
|
Revision: 1482 http://openutils.svn.sourceforge.net/openutils/?rev=1482&view=rev Author: molaschi Date: 2009-10-14 13:58:46 +0000 (Wed, 14 Oct 2009) Log Message: ----------- MEDIA-28 fix Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2009-10-09 19:31:24 UTC (rev 1481) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2009-10-14 13:58:46 UTC (rev 1482) @@ -94,7 +94,15 @@ { super(name, request, response); cacheKiller = String.valueOf(new Date().getTime()); + } + /** + * {@inheritDoc} + */ + @Override + public void init() + { + super.init(); if (actMedia != null) { HierarchyManager mgr = MgnlContext.getHierarchyManager(MediaModule.REPO); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2010-05-02 18:08:30
|
Revision: 2333 http://openutils.svn.sourceforge.net/openutils/?rev=2333&view=rev Author: fgiust Date: 2010-05-02 18:08:24 +0000 (Sun, 02 May 2010) Log Message: ----------- MEDIA-113 don't try to load an empty media Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2010-05-02 18:07:10 UTC (rev 2332) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2010-05-02 18:08:24 UTC (rev 2333) @@ -99,7 +99,7 @@ public void init() { super.init(); - if (actMedia != null) + if (StringUtils.isNotBlank(actMedia)) { HierarchyManager mgr = MgnlContext.getHierarchyManager(MediaModule.REPO); try This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2011-03-23 13:57:32
|
Revision: 3396 http://openutils.svn.sourceforge.net/openutils/?rev=3396&view=rev Author: diego_schivo Date: 2011-03-23 13:57:26 +0000 (Wed, 23 Mar 2011) Log Message: ----------- MEDIA-223 URLDecoder.decode Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2011-03-23 13:44:39 UTC (rev 3395) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2011-03-23 13:57:26 UTC (rev 3396) @@ -32,6 +32,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -151,7 +153,14 @@ { if (StringUtils.isEmpty(openPath)) { - openPath = cookie.getValue(); + try + { + openPath = URLDecoder.decode(cookie.getValue(), "UTF-8"); + } + catch (UnsupportedEncodingException e) + { + // should never happen + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2011-07-11 14:25:33
|
Revision: 3577 http://openutils.svn.sourceforge.net/openutils/?rev=3577&view=rev Author: diego_schivo Date: 2011-07-11 14:25:27 +0000 (Mon, 11 Jul 2011) Log Message: ----------- MEDIA-246 log.debug Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2011-07-03 15:51:05 UTC (rev 3576) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2011-07-11 14:25:27 UTC (rev 3577) @@ -151,6 +151,7 @@ { if ("mediafolderpath".equals(cookie.getName())) { + log.debug("Found mediafolderpath cookie with value {}", cookie.getValue()); if (StringUtils.isEmpty(openPath)) { try @@ -162,6 +163,7 @@ // should never happen } } + log.debug("openPath={}", openPath); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |