Skip to content

Commit dfdfaed

Browse files
authored
Merge pull request #18 from krassowski/warn-on-missing-crc
Allow to pass with a warning when CRC == 0
2 parents 580cb01 + 3cf2238 commit dfdfaed

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# IPython data-vault
2-
[![tests](https://github.com/krassowski/data-vault/workflows/test/badge.svg)](https://github.com/krassowski/data-vault/actions?query=workflow%3test+branch%3Amaster)
2+
[![tests](https://github.com/krassowski/data-vault/workflows/tests/badge.svg)](https://github.com/krassowski/data-vault/actions/workflows/tests.yml)
33
![CodeQL](https://github.com/krassowski/data-vault/workflows/CodeQL/badge.svg)
44
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)
55
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/krassowski/data-vault/master?filepath=Example.ipynb)

data_vault/vault.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import hashlib
55
from typing import Dict
66
import zlib
7+
from warnings import warn
78

89
from pandas import read_csv
910

@@ -122,7 +123,15 @@ def load_object(self, path, variable_name, importer=None, to_globals=True):
122123
frame_manager.get_ipython_globals()[variable_name] = obj
123124

124125
# check integrity of a single file
125-
assert info.CRC == crc_as_int
126+
if info.CRC != crc_as_int:
127+
if info.CRC == 0:
128+
# https://sourceforge.net/p/sevenzip/discussion/45798/thread/c284a85f3f/
129+
warn(
130+
'CRC not found, cannot verify integrity (note:'
131+
' this is expected for newer versions of 7zip when using AES encryption)'
132+
)
133+
else:
134+
raise ValueError(f'CRC do not match: {info.CRC} { crc_as_int}')
126135

127136
metadata = {
128137
'new_file': {

0 commit comments

Comments
 (0)