Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gramps XML export (and thus synchronization) can fail in case of corrupted objects #479

Open
DavidMStraub opened this issue Jan 28, 2024 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@DavidMStraub
Copy link
Member

If some objects contain invalid data, such as None as handle, Gramps XML export can fail, which prevents backup as well as synchronization. We should have something like a "repair database" endpoint.

@DavidMStraub DavidMStraub added bug Something isn't working enhancement New feature or request labels Jan 28, 2024
@DavidMStraub
Copy link
Member Author

DavidMStraub commented Jan 28, 2024

The best solution would of course be to just use the Gramps built-in check & repair tool, however that does not work since it also tries to check media checksums, which generally will not for in Web API because media files are managed differently.

So the best solution for now in my opinion would be to create a new addon that is a ligher (or customizable) version of check.py, but not reimplementing any of the logic.

On second though, I think an addon is overkill - we can just create a background task that runs the functions in the check and repair tool except media checksums.

@DavidMStraub
Copy link
Member Author

Example traceback:

  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportxml.py", line 179, in write
    self.write_xml_data()
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportxml.py", line 313, in write_xml_data
    self.write_source(source,2)
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportxml.py", line 616, in write_source
    self.write_media_list(source.get_media_list(), index+1)
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportxml.py", line 1129, in write_media_list
    self.g.write('%s<objref hlink="%s"' % (sp,"_"+mobj_id))
                                              ~~~^~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

DavidMStraub added a commit to DavidMStraub/gramps-webapi that referenced this issue Jan 30, 2024
@DavidMStraub DavidMStraub self-assigned this Jan 30, 2024
@DavidMStraub
Copy link
Member Author

To be confirmed whether this is actually fixed.

@DavidMStraub DavidMStraub reopened this Feb 3, 2024
@DavidMStraub
Copy link
Member Author

Confirmed by the user that the issue is not fixed - media references with ref None still cause this error after running check & repair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant