joethei / obsidian-plantuml

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

Fails to generate diagram with multiple internal Wikilinks #21

Closed kestoske closed 2 years ago

kestoske commented 2 years ago

What happened?

Everything works for a single link and links to external sources. Once I add multiple internal Wikilinks it keeps showing Generating PlantUML diagram. Example:

```plantuml-svg
Bob -> Alice : [[[test1]]]
Alice -> Wonderland: [[[test2]]]
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello

### Obsidian version

0.13.23

### Plugin version

1.5.1

### What distribution are you seeing the problem on?

Desktop

### Are you using a local `.jar` or a remote server

server

### Relevant log output

```shell
app.js:1 Uncaught (in promise) TypeError: Cannot read property 'path' of null
    at t.getObsidianUrl (app.js:1)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:4863:35)
    at String.replace (<anonymous>)
    at Replacer.replaceLinks (eval at <anonymous> (app.js:1), <anonymous>:4860:17)
    at DebouncedProcessors.eval (eval at <anonymous> (app.js:1), <anonymous>:5233:39)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:70:61)
    at new Promise (<anonymous>)
    at __async (eval at <anonymous> (app.js:1), <anonymous>:54:10)
    at DebouncedProcessors.processor (eval at <anonymous> (app.js:1), <anonymous>:5220:54)
    at DebouncedProcessors.eval (eval at <anonymous> (app.js:1), <anonymous>:5218:18)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:70:61)
    at new Promise (<anonymous>)
    at __async (eval at <anonymous> (app.js:1), <anonymous>:54:10)
    at DebouncedProcessors.svg (eval at <anonymous> (app.js:1), <anonymous>:5217:37)
joethei commented 2 years ago

From the error message it seems like that one of the linked files does not exist. Can you confirm that?

kestoske commented 2 years ago

On my local environment I was testing with existing files.

kestoske commented 2 years ago

As I understand the issue is here:

const file = this.plugin.app.metadataCache.getFirstLinkpathDest(split[0], path);

where split[0] = "test1]]]\r\nAlice -> Wonderland: [[[test2";

joethei commented 2 years ago

Yeah, thats what I found to, currently trying to reproduce another issue before shiping the fix.