Skip to content

Commit

Permalink
Fix generate activity records (#311)
Browse files Browse the repository at this point in the history
* fix generate_activity_records

* filtered_records
  • Loading branch information
SkywalkerSpace authored Jan 18, 2024
1 parent 3418986 commit f4db666
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions events/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,18 +682,20 @@ def generate_activity_records(added_files, deleted_files, added_dirs,
record['old_path'] = de.path
records.append(record)

filtered_records = []
for record in records:
if os.path.dirname(record['path']).startswith('/images/auto-upload'):
records.remove(record)
continue
if os.path.dirname(record['path']).startswith('/images/sdoc'):
records.remove(record)
continue
if os.path.dirname(record['path']).startswith('/_Internal'):
records.remove(record)
continue
if 'old_path' in record:
record['old_path'] = record['old_path'].rstrip('/')
record['path'] = record['path'].rstrip('/') if record['path'] != '/' else '/'
filtered_records.append(record)

return records
return filtered_records

def list_file_in_dir(repo_id, dirents, op_type):
_dirents = copy.copy(dirents)
Expand Down

0 comments on commit f4db666

Please sign in to comment.