Skip to content

Commit 249115d

Browse files
committed
Remove trailing '.' for cached file with empty R/E
- R/E: renderer name and exporter name - `get_render_name()` and `get_exporter_name()` return '' when rendering/exporting a given type is not supported. Update `cache_file_path` for both to be removed of the trailing dot
1 parent 3483fa8 commit 249115d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

mfr/server/handlers/export.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ async def prepare(self):
3333

3434
self.cache_file_id = '{}.{}'.format(self.metadata.unique_key, self.format)
3535

36-
self.cache_file_path = await self.cache_provider.validate_path(
37-
'/export/{}.{}'.format(self.cache_file_id, self.exporter_name)
38-
)
36+
if self.exporter_name:
37+
cache_file_path_str = '/export/{}.{}'.format(self.cache_file_id, self.exporter_name)
38+
else:
39+
cache_file_path_str = '/export/{}'.format(self.cache_file_id)
40+
self.cache_file_path = await self.cache_provider.validate_path(cache_file_path_str)
41+
3942
self.source_file_path = await self.local_cache_provider.validate_path(
4043
'/export/{}'.format(self.source_file_id)
4144
)

mfr/server/handlers/render.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ async def prepare(self):
2727
self.renderer_name = utils.get_renderer_name(self.metadata.ext)
2828

2929
self.cache_file_id = self.metadata.unique_key
30-
self.cache_file_path = await self.cache_provider.validate_path(
31-
'/render/{}.{}'.format(self.cache_file_id, self.renderer_name)
32-
)
30+
31+
if self.renderer_name:
32+
cache_file_path_str = '/export/{}.{}'.format(self.cache_file_id, self.renderer_name)
33+
else:
34+
cache_file_path_str = '/export/{}'.format(self.cache_file_id)
35+
self.cache_file_path = await self.cache_provider.validate_path(cache_file_path_str)
36+
3337
self.source_file_path = await self.local_cache_provider.validate_path(
3438
'/render/{}'.format(self.source_file_id)
3539
)

0 commit comments

Comments
 (0)