Praxxian / lava-flow

A Foundry VTT module that allows you to import your notes from Obsidian MD into Foundry journal entries.
MIT License
61 stars 9 forks source link

Not respecting links #3

Closed anthonydeaver closed 2 years ago

anthonydeaver commented 2 years ago

I installed this a couple days ago and imported my Obsidian vault, when I looked at the pages in the Journal none of the links were maintained, they were all text. Is there only a certain format the plugin expects for links? Screenshot_122121_054958_PM

anthonydeaver commented 2 years ago

The page in Obsidian Screenshot_122121_054934_PM

Praxxian commented 2 years ago

Thanks for providing those screenshots! That helps a ton. Nothing seems wrong with those links just from looking at them.

I have to ask the obvious just in case: were the notes associated to those links imported as well? This could happen if you import a subfolder and it contains links that were not imported.

anthonydeaver commented 2 years ago

Side by Side in Foundry and Obsidian. I'm assuming the one in Foundry is/was the one in Obsidian. :)

Showing the obsidian versions in edit mode so you can see that the data in both files match. Also figured edit mode might show anything 'off'.

What I find really odd is in both pages, the link to the Eberron 'parent' page (the page under which all the imported files belong) is linked. But that's the only one.

Screenshot_122321_072413_PM Screenshot_122321_072524_PM

Praxxian commented 2 years ago

Did you receive an "import complete" message? I am wondering if there is some underlying bug that stopped the link replacement from completing.

I did fix one bug. Could you please try upgrading the module to the latest version and seeing if you can still reproduce the issue?

anthonydeaver commented 2 years ago

Negative, same result. Even deleted that world and created a new one and reimported. Same pages, same results, no linkage.

anthonydeaver commented 2 years ago

Just saw you question about the "Import Complete" messaged so I created another world and imported again, this time with the debug console open. Sure enough, it threw an error in the console:

SyntaxError: Invalid regular expression: /\[\[(Calendar|Eberron/Modules/Eberron Campaign Setting (3)\]\]/: Unterminated group at new RegExp (<anonymous>) at MDFileInfo.getKeyRegex (lava-flow.js:313) at Function.updateLinks (lava-flow.js:210) at Function.importVault (lava-flow.js:77) at async LavaFlowConfig._updateObject (lava-flow.js:260) at async LavaFlowConfig._onSubmit (foundry.js:3822)

So I did some further digging. The files it's complaining about below is actually titled Eberron Campaign Setting (3.5). I renamed it, removing the (3.5) and everything imported without issue.

At first I thought it might not like the extra period in 3.5 so I renamed another file, adding an extra couple of periods but that also imported without issue. So I then renamed another file called Forgotten Forge to Forgotten Forge (3.5) and it failed again with the same error message as above, 'Unterminated group'

It doesn't like having a period (a.k.a. 'separator') inside the parens. I'm guessing that on line 309 in lava-flow.js, when you split on the separator for this filename it's returning Eberron Campaign Setting (3. as the fullKey which the regex freaks out about because of the open paren.

I can easily work around this by removing the '(3.5)'. I don't know if a lot of people will do things like this, but it's something to maybe think about in the future. At least for cases when someone else reports the issue :)

Anyway, great work!

Praxxian commented 2 years ago

My next suggestion was going to be to open the console, so thanks for anticipating!

Yeah I need to do some regex escaping. You shouldn't have to remove that stuff for it to work. I'll update when I have a fix for that, but glad to hear you have a workaround.

Praxxian commented 2 years ago

Release 1.0.3 resolves this issue. Thanks for your feedback!