mirror of
https://github.com/netinvent/npbackup.git
synced 2024-09-20 06:46:13 +08:00
upgrade_server: Return an empty response if no file available
This commit is contained in:
parent
5c3601fd90
commit
6f5e4b2035
|
@ -159,6 +159,9 @@ def auto_upgrader(
|
|||
except (KeyError, TypeError):
|
||||
logger.error("Cannot get file description")
|
||||
return False
|
||||
if sha256sum is None:
|
||||
logger.info("No upgrade file found for me")
|
||||
return False
|
||||
|
||||
file_data = requestor.requestor("download/" + id_record, raw=True)
|
||||
if not file_data:
|
||||
|
|
|
@ -96,7 +96,15 @@ def get_file(file: FileGet, content: bool = False) -> Optional[Union[FileSend, b
|
|||
)
|
||||
logger.info("Searching for %s", path)
|
||||
if not os.path.isfile(path):
|
||||
return None
|
||||
logger.info(f"No upgrade file found in {path}")
|
||||
return FileSend(
|
||||
arch=file.arch.value,
|
||||
platform=file.platform.value,
|
||||
sha256sum=None,
|
||||
filename=None,
|
||||
file_length=0,
|
||||
)
|
||||
|
||||
with open(path, "rb") as fh:
|
||||
bytes = fh.read()
|
||||
if content:
|
||||
|
|
Loading…
Reference in a new issue