libresign icon indicating copy to clipboard operation
libresign copied to clipboard

Signed document can't be validated if the original is deleted

Open tasagore opened this issue 3 years ago • 1 comments

Steps:

  1. Upload document.pdf and request a signature
  2. Sign the document
  3. Validate the document, all works ok
  4. Delete the original document (not the signed one)
  5. Validate the document, it fails (document not found)

I've observed the table oc_libresign_file, there is a field for the signed document (signed_node_id) and another for the original document (node_id). It has sense meanwhile the document is not totally signed but when it's signed the node_id should not be relevant.

When I delete the original document (step 4) the register in the oc_libresing_file is also deleted so the signed document can't be validated, although exists.

Don't know if it's a bug or a standard behavior, but for me has no sense to have a document that can't be validated if the original document does not exists.

tasagore avatar Aug 31 '22 07:08 tasagore

Hi @tasagore this behavior is expected, but make sense that you saw.

Origin of problem: If I request to sign a document, don't sign, and after this delete the document, will have a register in table libresign_file and will get error in all places that will be necessary get the file because the file don't exist more. To solve this problem I implemented a listener https://github.com/LibreSign/libresign/blob/346d389f44b334ba0cbc08333f77ed8b32b59b7a/lib/AppInfo/Application.php#L32 to delete the register when the file is deleted.

I think that to solve, could verify the status before the above described event and if the status is equal to signed, only set node_id to null and don't delete the file. Will be necessary to check if we will have side effects after do this change.

vitormattos avatar Oct 07 '22 14:10 vitormattos

I guess you will not have side effects. I've made a small process that do exactly that, when a document status is signed I set node_id to null and after that delete the original document (I need that behavior) and all runs fine.

tasagore avatar Oct 15 '22 18:10 tasagore

Hi @tasagore I already did the fix but don't create a new release of app. This fix will come maybe in the next weekend.

vitormattos avatar Oct 17 '22 16:10 vitormattos

Fixed, I recommend to use server with version 25

vitormattos avatar Oct 26 '22 03:10 vitormattos