Skip to content

Commit 769cc16

Browse files
committed
Fixes #93
1 parent 2cb8193 commit 769cc16

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

src/main/java/org/cryptomator/linux/quickaccess/NautilusBookmarks.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public class NautilusBookmarks implements QuickAccessService {
2929

3030
@Override
3131
public QuickAccessService.QuickAccessEntry add(Path target, String displayName) throws QuickAccessServiceException {
32-
String entryLine = "file://" + target.toAbsolutePath() + " " + displayName;
32+
var uriPath = target.toAbsolutePath().toString().replace(" ", "%20");
33+
String entryLine = "file://" + uriPath + " " + displayName;
3334
try {
3435
BOOKMARKS_LOCK.lock();
3536
if (Files.size(BOOKMARKS_FILE) > MAX_FILE_SIZE) {

src/test/java/org/cryptomator/linux/quickaccess/NautilusBookmarksIT.java

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import org.junit.jupiter.api.Test;
1010
import org.junit.jupiter.api.io.TempDir;
1111

12+
import java.io.IOException;
13+
import java.nio.file.Files;
1214
import java.nio.file.Path;
1315
import java.time.Duration;
1416

@@ -25,11 +27,42 @@ public void testSupport() {
2527
}
2628

2729
@Test
28-
@DisplayName("Adds for 20s an entryto the Nautilus sidebar")
30+
@DisplayName("Adds for 20s an entry to the Nautilus sidebar")
2931
@Disabled
30-
public void testSidebarIntegration(@TempDir Path tmpdir) throws QuickAccessServiceException, InterruptedException {
31-
var entry = new NautilusBookmarks().add(tmpdir, "integrations-linux");
32+
public void testSidebarIntegrationEasy(@TempDir Path tmpdir) throws QuickAccessServiceException, InterruptedException, IOException {
33+
var target = tmpdir.resolve("foobar");
34+
testSidebarIntegration(target, "foobar");
35+
}
36+
37+
@Test
38+
@DisplayName("Adds for 20s an entry to the Nautilus sidebar. The target dir contains a space.")
39+
@Disabled
40+
public void testSidebarIntegrationSpace(@TempDir Path tmpdir) throws QuickAccessServiceException, InterruptedException, IOException {
41+
var target = tmpdir.resolve("foo bar");
42+
testSidebarIntegration(target, "foobar");
43+
}
44+
45+
@Test
46+
@DisplayName("Adds for 20s an entry to the Nautilus sidebar. The target dir contains non ascii.")
47+
@Disabled
48+
public void testSidebarIntegrationNonASCII(@TempDir Path tmpdir) throws QuickAccessServiceException, InterruptedException, IOException {
49+
var target = tmpdir.resolve("f한obÄr");
50+
testSidebarIntegration(target, "foobar");
51+
}
52+
53+
@Test
54+
@DisplayName("Adds for 20s an entry to the Nautilus sidebar. The target dir contains non ascii.")
55+
@Disabled
56+
public void testSidebarIntegrationName(@TempDir Path tmpdir) throws QuickAccessServiceException, InterruptedException, IOException {
57+
var target = tmpdir.resolve("foobar");
58+
testSidebarIntegration(target, "f한o bÄr");
59+
}
60+
61+
private void testSidebarIntegration(Path target, String name) throws IOException, InterruptedException, QuickAccessServiceException {
62+
Files.createDirectory(target);
63+
var entry = new NautilusBookmarks().add(target, name);
3264
Thread.sleep(Duration.ofSeconds(20));
3365
entry.remove();
3466
}
67+
3568
}

0 commit comments

Comments
 (0)