Преглед изворни кода

now really: fixed invalid URI during MOVE, if dest path contains special chars (like spaces)

Sebastian Stenzel пре 9 година
родитељ
комит
ac4a68649e

+ 7 - 8
main/frontend-webdav/src/main/java/org/cryptomator/frontend/webdav/filters/UriNormalizationFilter.java

@@ -128,26 +128,25 @@ public class UriNormalizationFilter implements HttpFilter {
 		@Override
 		public String getHeader(String name) {
 			if ((METHOD_MOVE.equalsIgnoreCase(getMethod()) || METHOD_COPY.equalsIgnoreCase(getMethod())) && HEADER_DESTINATION.equalsIgnoreCase(name)) {
-				final String uri = URI.create(super.getHeader(name)).getRawPath();
-				return bestGuess(uri);
+				return bestGuess(URI.create(super.getHeader(name)));
 			} else {
 				return super.getHeader(name);
 			}
 		}
 
-		private String bestGuess(String uri) {
-			final String pathWithinContext = StringUtils.removeStart(uri, contextPath);
+		private String bestGuess(URI uri) {
+			final String pathWithinContext = StringUtils.removeStart(uri.getPath(), contextPath);
 			final ResourceType resourceType = resourceTypeChecker.typeOfResource(pathWithinContext);
 			switch (resourceType) {
 			case FILE:
-				return asFileUri(uri);
+				return asFileUri(uri.getRawPath());
 			case FOLDER:
-				return asFolderUri(uri);
+				return asFolderUri(uri.getRawPath());
 			default:
 				if (this.getRequestURI().endsWith("/")) {
-					return asFolderUri(uri);
+					return asFolderUri(uri.getRawPath());
 				} else {
-					return asFileUri(uri);
+					return asFileUri(uri.getRawPath());
 				}
 			}
 		}