Skip to content
Snippets Groups Projects
Commit f04968b2 authored by srosse's avatar srosse
Browse files

OO-3918: check the real filename in VFS web service too

parent d0ad479c
No related branches found
No related tags found
No related merge requests found
......@@ -525,7 +525,7 @@ public class VFSWebservice {
for(PathSegment seg:path) {
String segPath = seg.getPath();
for(VFSItem item : directory.getItems(new SystemItemFilter())) {
if(normalize(item.getName()).equals(segPath)) {
if(item.getName().equals(segPath) || normalize(item.getName()).equals(segPath)) {
if(item instanceof VFSLeaf) {
if(path.get(path.size() - 1) == seg) {
resolvedItem = item;
......
......@@ -20,9 +20,15 @@
package org.olat.restapi;
import static org.junit.Assert.assertEquals;
import static org.olat.core.util.vfs.restapi.VFSWebservice.normalize;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.olat.core.util.vfs.restapi.VFSWebservice;
/**
*
* <h3>Description:</h3>
......@@ -30,13 +36,30 @@ import org.junit.Test;
* Initial Date: 28 jan. 2011 <br>
* @author srosse, stephane.rosse@frentix.com, www.frentix.com
*/
@RunWith(Parameterized.class)
public class FolderTest {
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "HASTDJUR", "HÄSTDJUR" },
{ "HASTDJUR", "HÄSTDJÜR" },
{ "HAST_DJUR", "HÄST_DJUR" },
{ "This_is_a_funky_String", "Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ" }
});
}
private String expected;
private String string;
public FolderTest(String expected, String string) {
this.expected = expected;
this.string = string;
}
@Test
public void testNormalizer() {
assertEquals("HASTDJUR", normalize("HÄSTDJUR"));
assertEquals("HASTDJUR", normalize("HÄSTDJÜR"));
assertEquals("HAST_DJUR", normalize("HÄST_DJUR"));
assertEquals("This_is_a_funky_String", normalize("Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ"));
String normalized = VFSWebservice.normalize(string);
assertEquals(expected, normalized);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment