samwilson / diagrams-extension

A MediaWiki extension that displays GraphViz, Mscgen, PlantUML, and Mermaid diagrams in wiki pages.
https://www.mediawiki.org/wiki/Extension:Diagrams
GNU General Public License v2.0
8 stars 12 forks source link

error message The file "mwstore://local-backend/local-public/diagrams/archive ... already exists #32

Closed WolfgangFahl closed 1 year ago

WolfgangFahl commented 3 years ago
The file "mwstore://local-backend/local-public/diagrams/archive/20210418085012!Diagrams_33c4fbf96cd07e2a50617e853179fffe.svg" already exists. 

appears in a newly create wiki page with a graphviz markup.

I tried changing the content of the diagram to:

<graphviz format='svg'>
 digraph test {
 a->b
}
</graphviz>

to no avail the message changed to:

The file "mwstore://local-backend/local-public/diagrams/archive/20210418085544!Diagrams_8d5e2c82639407fe6a22795f5215b725.svg" already exists. 

i tried storing the same content on a different page and the problem persisted now giving the message

The file "mwstore://local-backend/local-public/diagrams/archive/20210418085737!Diagrams_8d5e2c82639407fe6a22795f5215b725.svg" already exists. 

again

only when changing both the content and the page name containing a unique string

index.php?title=Workdocumentation_2021-04-18/test2012-04-18&action=edit
<graphviz format='svg'>
 digraph test2021_04_18_11_00 {
 a->b
}
</graphviz>

would i get a result again: grafik

WolfgangFahl commented 3 years ago

At least the error message might be changed to "digraph id 'test' has already been used - can't store diagram". Or a mechanism should be used that the storing mechanism allows for having the same graph id on different pages. Having multiple graphs with the same id on the same page might well be still an error. In any case the reason should be pointed out more clearly.

WolfgangFahl commented 3 years ago

Fun fact: after succesfully storing the above page the other pages are also saveable again and show the correct diagram (with the modified id)...

samwilson commented 1 year ago

I've added a fix for this, where it will not try to recreate an existing file. Duplicate diagram IDs should be fine. The diagrams are keyed by a hash of the content, so if there's no difference in content it'll re-use the same file.