Skip to content

Commit

Permalink
Trim whitespace from list names on save
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Petersson authored and buggmagnet committed May 6, 2024
1 parent 82b1aeb commit f9ecbc4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ios/MullvadSettings/CustomListRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public struct CustomListRepository: CustomListRepositoryProtocol {
public init() {}

public func save(list: CustomList) throws {
var list = list
list.name = list.name.trimmingCharacters(in: .whitespaces)

var lists = fetchAll()

if let listWithSameName = lists.first(where: { $0.name.compare(list.name) == .orderedSame }),
Expand Down

0 comments on commit f9ecbc4

Please sign in to comment.