ebullient / ttrpg-convert-cli

Utility to convert JSON data (for content you own) from 5etools or pf2etools into Obsidian-friendly Markdown.
https://www.ebullient.dev/projects/ttrpg-convert-cli/
Apache License 2.0
174 stars 37 forks source link

Unable to copy external images over https πŸ› #340

Closed lordmoocow closed 6 months ago

lordmoocow commented 6 months ago

When using a homebrew source with external image references, and setting copyExternal:true, the cli outputs a bunch of errors when attempting to download the images from the external source. The markdown output then attempts to reference files which do not exist.

What I would expect to happen is that the image is copied into the local output without error, and for the markdown image links to reference them correctly.

Also interesting to note, if copyExternal: false is set in the config, the same errors are output however the markdown does include working images as they still reference the external source (I'll attach a log for both).

The cli outputs errors such as:

[ πŸ›‘ ERR] Unable to copy remote image from https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_img/ExploringEberron/109%20brian%20hacan.png to 05. 5e Mechanics/books/exploring-eberron/img/109-20brian-20hacan.png (java.net.MalformedURLException: Accessing an URL protocol that was not enabled. The URL protocol https is supported but not enabled by default. It must be enabled by adding the --enable-url-protocols=https option to the native-image command.)
java.net.MalformedURLException: Accessing an URL protocol that was not enabled. The URL protocol https is supported but not enabled by default. It must be enabled by adding the --enable-url-protocols=https option to the native-image command.
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.JavaNetSubstitutions.unsupported(JavaNetSubstitutions.java:253)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.JavaNetSubstitutions.getURLStreamHandler(JavaNetSubstitutions.java:227)
        at java.base@17.0.9/java.net.URL.getURLStreamHandler(URL.java:79)
        at java.base@17.0.9/java.net.URL.<init>(URL.java:680)
        at java.base@17.0.9/java.net.URL.<init>(URL.java:569)
        at java.base@17.0.9/java.net.URL.<init>(URL.java:516)
        at dev.ebullient.convert.io.Tui.copyRemoteImage(Tui.java:450)
        at dev.ebullient.convert.io.Tui.copyImages(Tui.java:404)
        at dev.ebullient.convert.io.Tui_ClientProxy.copyImages(Unknown Source)
        at dev.ebullient.convert.tools.dnd5e.Tools5eMarkdownConverter.writeImages(Tools5eMarkdownConverter.java:44)
        at dev.ebullient.convert.tools.dnd5e.Tools5eMarkdownConverter.writeImages(Tools5eMarkdownConverter.java:21)
        at dev.ebullient.convert.RpgDataConvertCli.call(RpgDataConvertCli.java:256)
        at dev.ebullient.convert.RpgDataConvertCli.call(RpgDataConvertCli.java:39)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at dev.ebullient.convert.RpgDataConvertCli.executionStrategy(RpgDataConvertCli.java:272)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at dev.ebullient.convert.RpgDataConvertCli.run(RpgDataConvertCli.java:284)
        at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)

Configuration

minimal config to reproduce:

{
    "full-source": {
        "homebrew": [
            "/home/lmc/Documents/homebrew/Keith Baker; Exploring Eberron.json",
        ],
    },
    "paths": {
        "compendium": "/05. 5e Mechanics",
        "rules": "/05. 5e Mechanics/rules",
    },
    "images": {
        "copyExternal": true,
        "copyInternal": true,
        "internalRoot": "/home/lmc/Documents/5etools-img/",
    }
}

Sources:

ebullient commented 6 months ago

ok. you caught an issue with the native command (thankfully evident in the error message).

using the jar (JBang or Homebrew) will work around this. Thanks for reporting. ;) And running with logs! And attaching them! You get all the praise.