xwikisas / application-diagram

Create various types of diagrams using draw.io
GNU Lesser General Public License v2.1
0 stars 8 forks source link

The revision number of attachment does not increase after any modifications on diagram #274

Closed petrenkonikita112263 closed 4 months ago

petrenkonikita112263 commented 4 months ago

Prerequisites

Steps to reproduce

  1. Go to the Diagram home page
  2. Create an empty diagram entry
  3. Check the attachment section of the created diagram, where you will see two images, PNG and SVG with initial size and revision number 1.1
  4. Edit the diagram
  5. Make any modifications by adding figs, text or importing diagrams via URL or drawion file
  6. Save after that
  7. Check once again the attachment section

Actual result

The PNG and SVG versions will display the updated version of the diagram (by opening the new tab), and the size will be increased depending on amount of modifications. However, the revision number still will be 1.1

Expected result

The revision number of attachments for PNG and SVG files increases after each saved change.

petrenkonikita112263 commented 4 months ago

msedge_IywY6FRhKg

msedge_Okdzljz9dI

Additionally, I enabled the DEBUG level for com.xwiki.diagram, and have several records from logs

http://localhost:8080/xwiki/bin/preview/Diagram/FirstDiagram/WebHome] WARN  o.h.e.j.s.SqlExceptionHelper   - SQL Warning Code: -1100, SQLState: 02000 
2024-06-26 11:53:02,419 [qtp1629911510-19 - http://localhost:8080/xwiki/bin/preview/Diagram/FirstDiagram/WebHome] WARN  o.h.e.j.s.SqlExceptionHelper   - no data 
2024-06-26 12:08:40,569 [qtp1629911510-25 - http://localhost:8080/xwiki/bin/delattachment/Diagram/FirstDiagram/WebHome/diagram.svg?form_token=NIsAVYYeyoVsq4Sjq4rIxA&xredirect=%2Fxwiki%2Fbin%2Fget%2FDiagram%2FFirstDiagram%2F%3FoutputSyntax%3Dplain] WARN  o.h.e.j.s.SqlExceptionHelper   - SQL Warning Code: -1100, SQLState: 02000 
2024-06-26 12:08:40,571 [qtp1629911510-25 - http://localhost:8080/xwiki/bin/delattachment/Diagram/FirstDiagram/WebHome/diagram.svg?form_token=NIsAVYYeyoVsq4Sjq4rIxA&xredirect=%2Fxwiki%2Fbin%2Fget%2FDiagram%2FFirstDiagram%2F%3FoutputSyntax%3Dplain] WARN  o.h.e.j.s.SqlExceptionHelper   - no data 
2024-06-26 12:08:40,848 [XWiki Solr index thread] ERROR .DocumentSolrMetadataExtractor - Failed to retrieve the content of attachment [Attachment xwiki:Diagram.FirstDiagram.WebHome@diagram.png] 
com.xpn.xwiki.XWikiException: Error number 3002 in 3: The attachment [Attachment xwiki:Diagram.FirstDiagram.WebHome@diagram.png] (file D:\XWiki\xwiki-platform-distribution-flavor-jetty-hsqldb-14.10.16\data\store\file\xwiki\c\1\4b99789b03e5e9df3bb361e50395f8\attachments\7\a\159a536f47c017eb492297bb45c270\f.png) could not be found in the filesystem attachment store.
    at org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore.loadAttachmentContent(FilesystemAttachmentStore.java:214)
    at com.xpn.xwiki.doc.XWikiAttachment.loadAttachmentContent(XWikiAttachment.java:1107)
    at com.xpn.xwiki.doc.XWikiAttachment.reloadAttachmentContent(XWikiAttachment.java:931)
    at com.xpn.xwiki.doc.XWikiAttachment.getContentInputStream(XWikiAttachment.java:909)
    at org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor.getContentAsText(AbstractSolrMetadataExtractor.java:531)
    at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setAttachment(DocumentSolrMetadataExtractor.java:333)
    at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setAttachments(DocumentSolrMetadataExtractor.java:313)
    at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setExtras(DocumentSolrMetadataExtractor.java:239)
    at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setFieldsInternal(DocumentSolrMetadataExtractor.java:152)
    at org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor.getSolrDocument(AbstractSolrMetadataExtractor.java:171)
    at org.xwiki.search.solr.internal.DefaultSolrIndexer.lambda$getSolrDocument$0(DefaultSolrIndexer.java:525)
    at org.xwiki.bridge.internal.DefaultDocumentContextExecutor.call(DefaultDocumentContextExecutor.java:65)
    at org.xwiki.search.solr.internal.DefaultSolrIndexer.getSolrDocument(DefaultSolrIndexer.java:525)
    at org.xwiki.search.solr.internal.DefaultSolrIndexer.processBatch(DefaultSolrIndexer.java:428)
    at org.xwiki.search.solr.internal.DefaultSolrIndexer.run(DefaultSolrIndexer.java:393)
    at java.base/java.lang.Thread.run(Thread.java:833)
2024-06-26 12:08:40,879 [qtp1629911510-110 - http://localhost:8080/xwiki/bin/delattachment/Diagram/FirstDiagram/WebHome/diagram.png?form_token=NIsAVYYeyoVsq4Sjq4rIxA&xredirect=%2Fxwiki%2Fbin%2Fget%2FDiagram%2FFirstDiagram%2F%3FoutputSyntax%3Dplain] WARN  o.h.e.j.s.SqlExceptionHelper   - SQL Warning Code: -1100, SQLState: 02000 
2024-06-26 12:08:40,880 [qtp1629911510-110 - http://localhost:8080/xwiki/bin/delattachment/Diagram/FirstDiagram/WebHome/diagram.png?form_token=NIsAVYYeyoVsq4Sjq4rIxA&xredirect=%2Fxwiki%2Fbin%2Fget%2FDiagram%2FFirstDiagram%2F%3FoutputSyntax%3Dplain] WARN  o.h.e.j.s.SqlExceptionHelper   - no data 
2024-06-26 12:08:41,089 [qtp1629911510-25 - http://localhost:8080/xwiki/bin/preview/Diagram/FirstDiagram/WebHome] WARN  o.h.e.j.s.SqlExceptionHelper   - SQL Warning Code: -1100, SQLState: 02000 
2024-06-26 12:08:41,091 [qtp1629911510-25 - http://localhost:8080/xwiki/bin/preview/Diagram/FirstDiagram/WebHome] WARN  o.h.e.j.s.SqlExceptionHelper   - no data

It was executed on 14.10.16 XWiki, but I also encountering the same behaviour on XWiki 14.10.

oanalavinia commented 4 months ago

Right now this is the expected behavior since keeping all versions will make the save process too heavy, check https://github.com/xwikisas/application-diagram/issues/49 These attachments should only be seen as snapshots of the current diagram content. If an user needs to rollback to a certain version, he can still do so by using the page history tab