@@ -159,12 +159,12 @@ async def process_entry(entry: dict, is_node: bool):
159159
160160 def create_file ():
161161 with open (_path , "a+" ) as f :
162- f .write (entry ["script" ])
162+ f .write (entry ["script" ] or "" )
163163
164164 if os .path .exists (_path ):
165165 if force :
166166 with open (_path , "r" ) as f :
167- changed = f .read ().splitlines () != entry ["script" ].splitlines ()
167+ changed = f .read ().splitlines () != ( entry ["script" ] or "" ) .splitlines ()
168168 os .remove (_path )
169169 create_file ()
170170 if changed :
@@ -176,7 +176,7 @@ def create_file():
176176 else :
177177 with open (_path , "r" ) as f :
178178 local_content = f .read ()
179- remote_content = entry ["script" ]
179+ remote_content = entry ["script" ] or ""
180180 diff = list (difflib .unified_diff (
181181 remote_content .splitlines (),
182182 local_content .splitlines (),
@@ -287,7 +287,7 @@ async def main(file_path: str = None):
287287 with open (_real_file , "r" ) as f :
288288 file_content = f .read ()
289289
290- if hashlib .sha256 (entry ["script" ].encode ("utf-8" )).digest () \
290+ if hashlib .sha256 (( entry ["script" ] or "" ) .encode ("utf-8" )).digest () \
291291 != hashlib .sha256 (file_content .encode ("utf-8" )).digest ():
292292 can_push = force
293293 if not can_push :
0 commit comments