Skip to content

Commit 9b2b54a

Browse files
committed
Release 0.0.56
1 parent e70de3e commit 9b2b54a

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "liquid-java",
33
"displayName": "LiquidJava",
44
"description": "Extending Java with Liquid Types",
5-
"version": "0.0.55",
5+
"version": "0.0.56",
66
"publisher": "AlcidesFonseca",
77
"repository": {
88
"type": "git",
420 Bytes
Binary file not shown.

server/src/main/java/utils/PathUtils.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package utils;
22

3+
import java.io.UnsupportedEncodingException;
34
import java.net.URI;
5+
import java.net.URLDecoder;
6+
import java.nio.charset.StandardCharsets;
47
import java.nio.file.Path;
58
import java.nio.file.Paths;
69

@@ -34,6 +37,7 @@ public static boolean isFileInDirectory(String fileUri, String directoryUri) {
3437
* @return base path
3538
*/
3639
public static String extractBasePath(String fullPath) {
40+
fullPath = convertUTFtoCharacters(fullPath);
3741
fullPath = fullPath.replace(FILE_PREFIX, "");
3842
int suffixIndex = fullPath.indexOf(SRC_SUFFIX);
3943
int nextSlashIndex = fullPath.indexOf("/", suffixIndex + SRC_SUFFIX.length());
@@ -42,6 +46,20 @@ public static String extractBasePath(String fullPath) {
4246
return fullPath.substring(0, nextSlashIndex); // up to and including the next slash after /src/
4347
}
4448

49+
/**
50+
* Converts a UTF-8 encoded string to a regular string
51+
* @param source
52+
* @return converted string
53+
*/
54+
private static String convertUTFtoCharacters(String source) {
55+
try {
56+
return URLDecoder.decode(source, StandardCharsets.UTF_8.name());
57+
} catch (UnsupportedEncodingException e) {
58+
// not going to happen - value came from JDK's own StandardCharsets
59+
return null;
60+
}
61+
}
62+
4563
/**
4664
* Converts a file path to a file:// URI
4765
* @param filePath the file path

0 commit comments

Comments
 (0)