Skip to content

Commit

Permalink
Merge pull request #12845 from iterate-ch/bugfix/GH-12812
Browse files Browse the repository at this point in the history
Workaround .NET assembly loading IKVM ServiceLoader interoperability screw-up
  • Loading branch information
dkocher committed Feb 3, 2022
2 parents 8405814 + afdc7e7 commit 78e810f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cli/src/main/csharp/ch/cyberduck/cli/WindowsTerminal.cs
Expand Up @@ -17,7 +17,6 @@
//

using ch.cyberduck.cli;
using ch.cyberduck.core.preferences;
using org.apache.commons.cli;
using Console = System.Console;

Expand All @@ -32,6 +31,14 @@ public WindowsTerminal(TerminalPreferences defaults, Options options, CommandLin

private static void Main(string[] args)
{
// HACK Cyberduck.Cryptomator.dll includes cryptolib v2, which uses java ServiceLoader.
// Without this hack the ServiceLoader is incapable of finding org.cryptomator.cryptolib.api.v1.CryptorProviderImpl,
// which results in non-working state of ch.cyberduck.core.cryptomator.CryptoVault.
// This is a transient dependency coming from Cyberduck.Cryptomator through Cyberduck.Cli,
// which isn't used in duck. Thus crazy stuff happens, and we have to force-load Cyberduck.Cryptomator here.
// ref https://github.com/iterate-ch/cyberduck/issues/12812
_ = typeof(org.cryptomator.cryptolib.api.CryptorProvider);

// set UTF-8 encoding, tested in mintty (cygwin, babun) and cmd.exe
java.lang.System.setProperty("file.encoding", "UTF-8");
Console.OutputEncoding = System.Text.Encoding.UTF8;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/main/csharp/duck.csproj
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<CyberduckReference Include="Core;Core.Native;Protocols;Cli" />
<CyberduckReference Include="Core;Core.Native;Protocols;Cli;Cryptomator" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 78e810f

Please sign in to comment.