fix pass2bw

This commit is contained in:
sid 2026-05-18 16:08:01 +02:00
parent fd68579042
commit 49c93c82e0

View file

@ -43,13 +43,20 @@ def process_csv(input_file, output_file):
if col not in new_row: if col not in new_row:
new_row[col] = default_val new_row[col] = default_val
folder = new_row.get('folder', '')
name = new_row.get('name', '')
if folder.startswith('www') and name:
if not name.startswith('http://') and not name.startswith('https://'):
new_row['login_uri'] = f'https://{name}'
else:
new_row['login_uri'] = name
if new_row['notes']: if new_row['notes']:
new_row['notes'] = new_row['notes'].replace('\n', ' ').replace('\r', ' ') new_row['notes'] = new_row['notes'].replace('\n', ' ').replace('\r', ' ')
new_row['notes'] = re.sub(r'\s+', ' ', new_row['notes']).strip() new_row['notes'] = re.sub(r'\s+', ' ', new_row['notes']).strip()
notes = new_row['notes'] notes = new_row['notes']
if notes: if notes:
# Look for pattern: "login: USERNAME"
match = re.search(r'login:\s*(\S+)', notes, re.IGNORECASE) match = re.search(r'login:\s*(\S+)', notes, re.IGNORECASE)
if match: if match:
username = match.group(1) username = match.group(1)