Skip to content
Snippets Groups Projects

Sanitize RO-Crate filename

Merged Bryan Brancotte requested to merge sanitize-filename into main
2 files
+ 14
2
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 5
1
@@ -155,5 +155,9 @@ class RO_Crate:
@@ -155,5 +155,9 @@ class RO_Crate:
self.fill_from_workflow()
self.fill_from_workflow()
self.dico.pop("temp_directory")
self.dico.pop("temp_directory")
with open(f"{self.workflow.get_output_dir()}/ro-crate-metadata-{self.workflow.get_name()}.json", 'w') as output_file :
name = self.workflow.get_name()
 
name = name.replace('github.com/', '')
 
name = re.sub(r"^[ .]|[/<>:\"\\|?*]+|[ .]$", "-", name)
 
 
with open(f"{self.workflow.get_output_dir()}/ro-crate-metadata-{name}.json", 'w') as output_file :
json.dump(self.dico, output_file, indent=2)
json.dump(self.dico, output_file, indent=2)
 
\ No newline at end of file
Loading