This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
The following commit(s) were added to refs/heads/master by this push:
new 76c92f43 [VFS-844] UriString of webdav-filename is twice URLEncoded in
moveTo operation
76c92f43 is described below
commit 76c92f431ed6dc80d988619cedbbaa2501f64224
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Sep 16 08:54:57 2023 -0400
[VFS-844] UriString of webdav-filename is twice URLEncoded in moveTo
operation
- Sort members
- Use try-with-resources
---
.../apache/commons/vfs2/ProviderRenameTests.java | 48 +++++++++++-----------
src/changes/changes.xml | 3 ++
2 files changed, 27 insertions(+), 24 deletions(-)
diff --git
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
index c59415fb..ce966803 100644
---
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
+++
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/ProviderRenameTests.java
@@ -96,23 +96,6 @@ public class ProviderRenameTests extends
AbstractProviderTestCase {
moveFile(scratchFolder, file, content);
}
- /**
- * Tests create-delete-create-a-file sequence on the same file system.
- */
- @Test
- public void testRenameFileWithSpaces() throws Exception {
- final FileObject scratchFolder = createScratchFolder();
-
- // Create direct child of the test folder
- final FileObject file = scratchFolder.resolveFile("file space.txt");
- assertFalse(file.exists());
-
- final String content = createTestFile(file);
-
- // Make sure we can move the new file to another file on the same file
system
- moveFile(scratchFolder, file, content);
- }
-
/**
* Moves a file from a child folder to a parent folder to test what
happens when the original folder is now empty.
*
@@ -141,20 +124,37 @@ public class ProviderRenameTests extends
AbstractProviderTestCase {
*/
@Test
public void testRenameFileIntoEmptyFolder() throws Exception {
+ try (FileObject scratchFolder = createScratchFolder();
+ // Create direct child of the test folder
+ final FileObject file =
scratchFolder.resolveFile("file1.txt")) {
+ assertFalse(file.exists());
+
+ final String content = createTestFile(file);
+
+ final FileObject destFolder =
scratchFolder.resolveFile("empty-target-folder");
+ destFolder.createFolder();
+ assertTrue("new destination must be folder",
destFolder.getType().hasChildren());
+ assertEquals("new destination must be empty", 0,
destFolder.getChildren().length);
+
+ moveFile(destFolder, file, content);
+ }
+ }
+
+ /**
+ * Tests create-delete-create-a-file sequence on the same file system.
+ */
+ @Test
+ public void testRenameFileWithSpaces() throws Exception {
final FileObject scratchFolder = createScratchFolder();
// Create direct child of the test folder
- final FileObject file = scratchFolder.resolveFile("file1.txt");
+ final FileObject file = scratchFolder.resolveFile("file space.txt");
assertFalse(file.exists());
final String content = createTestFile(file);
- final FileObject destFolder =
scratchFolder.resolveFile("empty-target-folder");
- destFolder.createFolder();
- assertTrue("new destination must be folder",
destFolder.getType().hasChildren());
- assertEquals("new destination must be empty", 0,
destFolder.getChildren().length);
-
- moveFile(destFolder, file, content);
+ // Make sure we can move the new file to another file on the same file
system
+ moveFile(scratchFolder, file, content);
}
}
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 76a18a72..aa70e971 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -136,6 +136,9 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="step-security-bot, Gary
Gregory">
[StepSecurity] ci: Harden GitHub Actions #401.
</action>
+ <action type="fix" issue="VFS-844" dev="ggregory" due-to="Thorsten
Beise, Gary Gregory">
+ UriString of webdav-filename is twice URLEncoded in moveTo operation.
+ </action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Seth Falco">
Add vscode files to gitignore #205.