You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/11/25 18:49:47 UTC
[commons-vfs] branch master updated: [VFS-793] GenericFileName.getURI() returns invalid URI.
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 2911ed0 [VFS-793] GenericFileName.getURI() returns invalid URI.
2911ed0 is described below
commit 2911ed060faee5240fb7bc7dc0855e83aeb63f1d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 25 13:49:45 2021 -0500
[VFS-793] GenericFileName.getURI() returns invalid URI.
See also [VFS-810].
---
.../provider/ftp/FtpFileNameParserTestCase.java | 51 ++++++++++++++++++++++
src/changes/changes.xml | 3 ++
2 files changed, 54 insertions(+)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTestCase.java
new file mode 100644
index 0000000..df085cd
--- /dev/null
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParserTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.vfs2.provider.ftp;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.vfs2.FileName;
+import org.apache.commons.vfs2.provider.GenericFileName;
+import org.junit.Test;
+
+/**
+ * Tests https://issues.apache.org/jira/browse/VFS-793.
+ *
+ * See also https://issues.apache.org/jira/browse/VFS-810.
+ */
+public class FtpFileNameParserTestCase {
+
+ @Test
+ public void testGenericFileName1() throws Exception {
+ final String uri = "ftp://blanks:blanks@localhost/path/file_b%20lanks";
+ final FileName n = FtpFileNameParser.getInstance().parseUri(null, null, uri);
+ assertTrue(n instanceof GenericFileName);
+ final String genericUri = n.getURI();
+ assertEquals(genericUri, uri.toString());
+ }
+
+ @Test
+ public void testGenericFileName2() throws Exception {
+ final String uri = "ftp://b%20lanks:b%20lanks@localhost/path/file";
+ final FileName n = FtpFileNameParser.getInstance().parseUri(null, null, uri);
+ assertTrue(n instanceof GenericFileName);
+ final String genericUri = n.getURI();
+ assertEquals(genericUri, uri.toString());
+ }
+}
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 653df06..ed41182 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -59,6 +59,9 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" issue="VFS-810" dev="ggregory" due-to="Jan Aelbrecht, Gary Gregory">
Percent encoded backslashes in authority of URLs aren't allowed for WebDav.
</action>
+ <action type="fix" issue="VFS-793" dev="ggregory" due-to="Vitali Nashkevich, Gary Gregory">
+ GenericFileName.getURI() returns invalid URI.
+ </action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Seth Falco">
Add vscode files to gitignore #205.