☔ Prevent issues if hash is n/a
Apparently it can happen that no hash is available for an STL file. See SERVER-TQ in Sentry. So let's be a bit more careful here. Closes #3107
This commit is contained in:
1 parent
30ddbfd324
commit
54c885f1ad
1 file changed
+2
-2
@@ -337,13 +337,13 @@ class FileManager(object):
|
||||
gcode_location=dest_location))
|
||||
else:
|
||||
source_meta = self.get_metadata(source_location, source_path)
|
||||
hash = source_meta["hash"]
|
||||
hash = source_meta.get("hash", "n/a")
|
||||
|
||||
import io
|
||||
links = [("model", dict(name=source_path))]
|
||||
_, stl_name = self.split_path(source_location, source_path)
|
||||
file_obj = StreamWrapper(os.path.basename(dest_path),
|
||||
io.BytesIO(u";Generated from {stl_name} {hash}\n".format(**locals()).encode("ascii", "replace")),
|
||||
io.BytesIO(u";Generated from {stl_name} (hash: {hash})\n".format(**locals()).encode("ascii", "replace")),
|
||||
io.FileIO(tmp_path, "rb"))
|
||||
|
||||
printer_profile = self._printer_profile_manager.get(printer_profile_id)
|
||||
|
||||
Reference in new issue
Block a user