Skip to content

Commit

Permalink
Добавлена обработка путей с пробелом
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Apr 6, 2020
1 parent 947feab commit 8974682
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/github/_1c_syntax/utils/Absolute.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static URI uri(String uri) {
}

public static URI uri(URI uri) {
var decodedUri = URI.create(uri.getScheme() + ":" + uri.getSchemeSpecificPart());
var decodedUri = URI.create(uri.getScheme() + ":" + uri.getSchemeSpecificPart().replace(" ", "%20"));

if ("file".equals(decodedUri.getScheme()) && decodedUri.getAuthority() == null) {
return path(new File(decodedUri)).toUri();
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/com/github/_1c_syntax/utils/AbsoluteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,15 @@ void testUriFromUntitledFromVSC() {
assertThat(uri).hasScheme("untitled");
}

@Test
void testUriFromStringWithSpaces() {
// given
var uriString = "file:///fake%20path/fake.bsl";

// when
var uri = Absolute.uri(uriString);

// then
assertThat(uri.getPath()).endsWith("fake.bsl");
}
}

0 comments on commit 8974682

Please sign in to comment.