mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-29 07:20:35 +00:00
Fix pubkey exception for dotfiles
This commit is contained in:
@@ -61,7 +61,7 @@ public interface SshIdentityStrategy {
|
||||
}
|
||||
|
||||
static FilePath getPublicKeyPath(FilePath file) {
|
||||
if (file.getExtension().isEmpty()) {
|
||||
if (file.getExtension().isEmpty() || file.isDotFile()) {
|
||||
return FilePath.of(file + ".pub");
|
||||
} else {
|
||||
return FilePath.of(file.getBaseName() + ".pub");
|
||||
|
||||
@@ -117,6 +117,12 @@ public final class FilePath {
|
||||
return components.getLast();
|
||||
}
|
||||
|
||||
public boolean isDotFile() {
|
||||
var name = getFileName();
|
||||
var lastDot = name.lastIndexOf(".");
|
||||
return lastDot == 0;
|
||||
}
|
||||
|
||||
public FilePath getBaseName() {
|
||||
var name = getFileName();
|
||||
var lastDot = name.lastIndexOf(".");
|
||||
|
||||
Reference in New Issue
Block a user