From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:49:54 +0000 (-0700) Subject: Prefer the metadata JSON file over the version JSON file (#7048) X-Git-Tag: v2.10.2~1^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91585a1fa69e37af84481cf79b86a7bf26627dad;p=thirdparty%2Fpaperless-ngx.git Prefer the metadata JSON file over the version JSON file (#7048) --- diff --git a/src/documents/management/commands/document_importer.py b/src/documents/management/commands/document_importer.py index 97b73b743a..3535e14763 100644 --- a/src/documents/management/commands/document_importer.py +++ b/src/documents/management/commands/document_importer.py @@ -166,10 +166,7 @@ class Command(CryptMixin, BaseCommand): ) return - if version_path.exists(): - with version_path.open() as infile: - self.version = json.load(infile)["version"] - elif metadata_path.exists(): + if metadata_path.exists(): with metadata_path.open() as infile: data = json.load(infile) self.version = data["version"] @@ -179,6 +176,9 @@ class Command(CryptMixin, BaseCommand): ) elif EXPORTER_CRYPTO_SETTINGS_NAME in data: self.load_crypt_params(data) + elif version_path.exists(): + with version_path.open() as infile: + self.version = json.load(infile)["version"] if self.version and self.version != version.__full_version_str__: self.stdout.write(