On 12/13/2010 02:59 PM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2010-12-13 14:59:20 +0100 (Mon, 13 Dec 2010)
New Revision: 33362
Modified:
platform/core/trunk/xwiki-extension/xwiki-extension-api/src/main/java/org/xwiki/extension/repository/internal/DefaultLocalExtensionRepository.java
Log:
XWIKI-5772: Extension Manager use invalid character in extension files names
Modified:
platform/core/trunk/xwiki-extension/xwiki-extension-api/src/main/java/org/xwiki/extension/repository/internal/DefaultLocalExtensionRepository.java
===================================================================
---
platform/core/trunk/xwiki-extension/xwiki-extension-api/src/main/java/org/xwiki/extension/repository/internal/DefaultLocalExtensionRepository.java 2010-12-13
13:39:11 UTC (rev 33361)
+++
platform/core/trunk/xwiki-extension/xwiki-extension-api/src/main/java/org/xwiki/extension/repository/internal/DefaultLocalExtensionRepository.java 2010-12-13
13:59:20 UTC (rev 33362)
@@ -23,6 +23,8 @@
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -289,14 +291,26 @@
private File getFile(String id, String version, String type)
{
- return new File(getRootFolder(), id + "-" + version + "." +
type);
+ return new File(getRootFolder(), getFileName(id, version, type));
}
private File getDescriptorFile(String id, String version)
{
- return new File(getRootFolder(), id + "-" + version +
".xed");
+ return new File(getRootFolder(), getFileName(id, version, "xed"));
}
+ private String getFileName(String id, String version, String extension)
+ {
+ String fileName = id + "-" + version + "." + extension;
+ try {
Tabs here, replace with spaces:
+ return URLEncoder.encode(fileName,
"UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // Should never happen
+
+ return fileName;
+ }
+ }
+
private void addElement(Document document, Element parentElement, String
elementName, String elementValue)
{
Element element = document.createElement(elementName);
--
Sergiu Dumitriu
http://purl.org/net/sergiu/