mirror of
https://github.com/yacy/yacy_search_server.git
synced 2026-10-25 05:54:15 +00:00
Merge pull request #836 from smokingwheels/fix-833-windows-servletresource-test
Fix ServletResource directory listing test on Windows
This commit is contained in:
2 files changed
+4
-4
No files matched your search
@@ -174,7 +174,7 @@ final class ServletResource {
|
||||
final boolean directory = Files.isDirectory(child);
|
||||
try {
|
||||
final String encoded = new URI(null, null, name, null).toASCIIString();
|
||||
html.append("<li><a href=\"").append(escapeHtml(base)).append(encoded);
|
||||
html.append("<li><a href=\"").append(escapeHtml(base)).append(escapeHtml(encoded));
|
||||
if (directory) {
|
||||
html.append('/');
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ public class ServletResourceTest {
|
||||
@Test
|
||||
public void createsEscapedDirectoryListing() throws Exception {
|
||||
final Path root = this.temporaryFolder.newFolder("root").toPath();
|
||||
Files.writeString(root.resolve("<entry>.txt"), "content", StandardCharsets.UTF_8);
|
||||
Files.writeString(root.resolve("entry &test.txt"), "content", StandardCharsets.UTF_8);
|
||||
Files.createDirectory(root.resolve("child"));
|
||||
final ServletResource directory = ServletResource.from(root.toUri().toURL());
|
||||
|
||||
final String listing = directory.getListHTML("/files/", true, null);
|
||||
assertTrue(listing.contains("href=\"../\""));
|
||||
assertTrue(listing.contains("%3Centry%3E.txt"));
|
||||
assertTrue(listing.contains("<entry>.txt"));
|
||||
assertTrue(listing, listing.contains("href=\"/files/entry%20&test.txt\""));
|
||||
assertTrue(listing, listing.contains(">entry &test.txt</a>"));
|
||||
assertTrue(listing.contains("href=\"/files/child/\""));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user