Skip to content

Commit bd11228

Browse files
authored
Fix: pontos-update-header Truncate file, so we do not left old file content. [#266]
Fix: `pontos-update-header` Truncate file, so we do not left old file content.
2 parents 51d106e + 5091b8d commit bd11228

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pontos/updateheader/updateheader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ def _update_file(
184184
fp.seek(fp_write)
185185
fp.write(new_line)
186186
fp.write(rest_of_file)
187+
# in some cases we replace "YYYY - YYYY" with "YYYY-YYYY"
188+
# resulting in 2 characters left at the end of the file
189+
# so we truncate the file, just in case!
190+
fp.truncate()
187191
print(
188192
f"{file}: Changed Licence Header Copyright Year "
189193
f'{copyright_match["modification_year"]} -> '

0 commit comments

Comments
 (0)