mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
json parse version string
This commit is contained in:
parent
6dbebf4806
commit
d02c7df75c
@ -1,6 +1,6 @@
|
|||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib
|
import urllib
|
||||||
import uuid
|
import uuid
|
||||||
@ -683,9 +683,11 @@ class RemoteVersionView(GenericAPIView):
|
|||||||
+ "/paperless-ngx/main/src/paperless/version.py",
|
+ "/paperless-ngx/main/src/paperless/version.py",
|
||||||
) as response:
|
) as response:
|
||||||
remote = response.read().decode("utf-8")
|
remote = response.read().decode("utf-8")
|
||||||
match = re.search(r"(\d+, \d+, \d+)", remote)
|
try:
|
||||||
if match:
|
remote_json = json.loads(remote)
|
||||||
remote_version = ".".join(match[0].split(", "))
|
remote_version = remote_json["tag_name"].replace("ngx-", "")
|
||||||
|
except ValueError:
|
||||||
|
logger.debug("An error occured parsing remote version json")
|
||||||
except urllib.error.URLError:
|
except urllib.error.URLError:
|
||||||
logger.debug("An error occured checking for available updates")
|
logger.debug("An error occured checking for available updates")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user