From 0423e00ffdfa2998c965b732f3bf9b9d93a68bf9 Mon Sep 17 00:00:00 2001 From: R Hirner Date: Fri, 26 Dec 2014 19:49:23 +0100 Subject: [PATCH] Repair some common invalid URLs, version bump to 0.6.9. invalid URLs, version bump to 0.6.9.1 --- .../java/at/bitfire/davdroid/URLUtilsTest.java | 12 ++++++++---- app/src/main/AndroidManifest.xml | 4 ++-- .../main/java/at/bitfire/davdroid/Constants.java | 2 +- .../main/java/at/bitfire/davdroid/URIUtils.java | 16 +++++++++++++++- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/at/bitfire/davdroid/URLUtilsTest.java b/app/src/androidTest/java/at/bitfire/davdroid/URLUtilsTest.java index 9c597271..e31a78c6 100644 --- a/app/src/androidTest/java/at/bitfire/davdroid/URLUtilsTest.java +++ b/app/src/androidTest/java/at/bitfire/davdroid/URLUtilsTest.java @@ -43,25 +43,29 @@ public class URLUtilsTest extends TestCase { public void testParseURI() throws Exception { // don't escape valid characters - String validPath = "/;:@&=$-_.+!*'(),"; + String validPath = "/;:@&=$-_.+!*'(),"; assertEquals(new URI("https://www.test.example:123" + validPath), URIUtils.parseURI("https://www.test.example:123" + validPath, false)); assertEquals(new URI(validPath), URIUtils.parseURI(validPath, true)); // keep literal IPv6 addresses (only in host name) assertEquals(new URI("https://[1:2::1]/"), URIUtils.parseURI("https://[1:2::1]/", false)); - // "~" as home directory + // "~" as home directory (valid) assertEquals(new URI("http://www.test.example/~user1/"), URIUtils.parseURI("http://www.test.example/~user1/", false)); assertEquals(new URI("/~user1/"), URIUtils.parseURI("/%7euser1/", true)); - // "@" in directory name + // "@" in path names (valid) assertEquals(new URI("http://www.test.example/user@server.com/"), URIUtils.parseURI("http://www.test.example/user@server.com/", false)); assertEquals(new URI("/user@server.com/"), URIUtils.parseURI("/user%40server.com/", true)); assertEquals(new URI("user@server.com"), URIUtils.parseURI("user%40server.com", true)); - // ":" in path names + // ":" in path names (valid) assertEquals(new URI("http://www.test.example/my:cal.ics"), URIUtils.parseURI("http://www.test.example/my:cal.ics", false)); assertEquals(new URI("/my:cal.ics"), URIUtils.parseURI("/my%3Acal.ics", true)); assertEquals(new URI(null, null, "my:cal.ics", null, null), URIUtils.parseURI("my%3Acal.ics", true)); + + // common invalid path names + assertEquals(new URI(null, null, "my cal.ics", null, null), URIUtils.parseURI("my cal.ics", true)); + assertEquals(new URI(null, null, "{1234}.vcf", null, null), URIUtils.parseURI("{1234}.vcf", true)); } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 03b85172..a3df1155 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="49" + android:versionName="0.6.9.1" android:installLocation="internalOnly"> " + repaired); + + URI uri = new URI(repaired); URI normalized = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), uri.getQuery(), uri.getFragment()); Log.v(TAG, "Normalized URL " + original + " -> " + normalized.toASCIIString()); return normalized;