Skip to content

Commit eff2d90

Browse files
committed
Merge branch 'feature/jamovi-new-manifest' into develop
Closes: #369
2 parents 658933d + 9e148c4 commit eff2d90

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

mfr/extensions/jamovi/render.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,20 @@ def _check_file(self, zip_file):
6666
"""
6767
# Extract manifest file content
6868
try:
69-
with zip_file.open('META-INF/MANIFEST.MF') as manifest_data:
70-
manifest = manifest_data.read().decode('utf-8')
69+
try:
70+
# new manifest location
71+
with zip_file.open('meta') as manifest_data:
72+
manifest = manifest_data.read().decode('utf-8')
73+
except KeyError:
74+
# old manifest location
75+
with zip_file.open('META-INF/MANIFEST.MF') as manifest_data:
76+
manifest = manifest_data.read().decode('utf-8')
7177
except KeyError:
7278
raise jamovi_exceptions.JamoviFileCorruptError(
73-
'{} Missing META-INF/MANIFEST.MF'.format(self.MESSAGE_FILE_CORRUPT),
79+
'{} Missing manifest'.format(self.MESSAGE_FILE_CORRUPT),
7480
extension=self.metadata.ext,
7581
corruption_type='key_error',
76-
reason='zip missing ./META-INF/MANIFEST.MF',
82+
reason='zip missing manifest',
7783
)
7884

7985
lines = manifest.split('\n')
4.6 KB
Binary file not shown.

tests/extensions/jamovi/test_renderer.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ def metadata():
1515
'http://wb.osf.io/file/jamovi.omv?token=1337')
1616

1717
@pytest.fixture
18-
def ok_path():
19-
return os.path.join(BASE_PATH, 'ok.omv')
18+
def ok_new_manifest_path():
19+
return os.path.join(BASE_PATH, 'ok-new-manifest.omv')
20+
21+
@pytest.fixture
22+
def ok_old_manifest_path():
23+
return os.path.join(BASE_PATH, 'ok-old-manifest.omv')
2024

2125
@pytest.fixture
2226
def ok_with_image_path():
@@ -63,8 +67,8 @@ def extension():
6367
return '.omv'
6468

6569
@pytest.fixture
66-
def renderer(metadata, ok_path, url, assets_url, export_url):
67-
return JamoviRenderer(metadata, ok_path, url, assets_url, export_url)
70+
def renderer(metadata, ok_new_manifest_path, url, assets_url, export_url):
71+
return JamoviRenderer(metadata, ok_new_manifest_path, url, assets_url, export_url)
6872

6973

7074
class TestCodeJamoviRenderer:
@@ -73,6 +77,11 @@ def test_render_jamovi(self, renderer):
7377
body = renderer.render()
7478
assert '<div style="word-wrap: break-word; overflow: auto;" class="mfrViewer">' in body
7579

80+
def test_render_jamovi_old_manifest(self, metadata, ok_old_manifest_path, url, assets_url, export_url):
81+
renderer = JamoviRenderer(metadata, ok_old_manifest_path, url, assets_url, export_url)
82+
body = renderer.render()
83+
assert '<div style="word-wrap: break-word; overflow: auto;" class="mfrViewer">' in body
84+
7685
def test_render_jamovi_with_image(self, metadata, ok_with_image_path, url, assets_url,
7786
export_url):
7887
renderer = JamoviRenderer(metadata, ok_with_image_path, url, assets_url, export_url)

0 commit comments

Comments
 (0)