joethei / obsidian-plantuml

Generate PlantUML Diagrams inside Obsidian.md
MIT License
368 stars 18 forks source link

Deflate/Encoding issue with published material -- add support for header to be added `~1` #57

Closed zanodor closed 4 months ago

zanodor commented 4 months ago

Re

I have found a near four-year-old topic here, with the problem:

The plugin you are using seems to generated a bad URL.
This URL does not look like DEFLATE data.
It looks like your plugin is using HUFFMAN encoding.
This means you have now to add an header ~1 to your data. For example, you have to change:
http://www.plantuml.com/plantuml/png/VPG_J-Cm5CTd_2ai64wAg4hQfcaHL1...
to
http://www.plantuml.com/plantuml/png/~1VPG_J-Cm5CTd_2ai64wAg4hQfcaHL1...
It will work this way

Suggestion

I'm using a Digital Garden that probably draws upon this plugin as I didn't find anything related to plantuml server urls. I have found in your code:

// src/settings.ts
var import_obsidian = __toModule(require("obsidian"));
var DEFAULT_SETTINGS = {
  server_url: "https://www.plantuml.com/plantuml",
  header: "",
  debounce: 3,
  localJar: "",
  javaPath: "java",
  dotPath: "dot",
  defaultProcessor: "png",
  cache: 60
};

...where I see header with an empty string.

Would you consider a fix that tries sending either or both URLs so that the online site would generate the images? I have no issues locally in Obsidian, mind you.

Alternative solution

DIdn't tried modifying the script as I know it would have no bearing on the DG template which probably takes the last working code from GH (I assume). Having no experience in coding, I'd find it hard to inject a fix to the DG template but I'm open to suggestions.

Edit. In your plugin settings, is there something to do with this: Screenshot from 2024-03-10 15-43-53

Additional info

Both png and svg generation are affected and both URLs need to be patched.

Thanks for your attention, Z.

zanodor commented 4 months ago

Actually, it looks like the template uses a five-year-old 1.4.1. version of markdown-it-plantuml. So nothing to be done on your end.