mirror of
https://github.com/frej/fast-export.git
synced 2026-02-26 06:20:42 +01:00
Fix errors resulting from #318
When commit ddfc3a8300 ("Run file_data_filter on deleted files")
started calling the file_data_filter plugin method, in order to make
deletion of plugin-renamed files work, the example plugins were not
updated. This commit updates the example plugins to not crash when the
file context is None.
Thanks to @hetas discovering this.
Closes 328
This commit is contained in:
@@ -6,6 +6,8 @@ class Filter():
|
||||
pass
|
||||
|
||||
def file_data_filter(self,file_data):
|
||||
if file_data['file_ctx'] == None:
|
||||
return
|
||||
file_ctx = file_data['file_ctx']
|
||||
if not file_ctx.isbinary():
|
||||
file_data['data'] = file_data['data'].replace(b'\r\n', b'\n')
|
||||
|
||||
@@ -15,6 +15,8 @@ class Filter:
|
||||
d = file_data['data']
|
||||
file_ctx = file_data['file_ctx']
|
||||
filename = file_data['filename']
|
||||
if file_ctx == None:
|
||||
return
|
||||
filter_cmd = self.filter_contents + [filename, node.hex(file_ctx.filenode()), '1' if file_ctx.isbinary() else '0']
|
||||
try:
|
||||
filter_proc = subprocess.Popen(filter_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user