Files
Fast-Export/plugins/dos2unix/__init__.py
Frej Drejhammar 893d6302b7 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
2024-04-07 15:23:08 +02:00

14 lines
363 B
Python

def build_filter(args):
return Filter(args)
class Filter():
def __init__(self, args):
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')