Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Update ExtraNetworksCard.jsx #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cozy-nest-client/cozy_extra_network/ExtraNetworksCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,22 @@ export function ExtraNetworksCard({item, searchString, selectedFolder, nsfwFilte
const hasSelectFolder = selectedFolder && selectedFolder !== ''

function normalizePath(path) {
return path.replace(/[\/\\:]/g, '')
return path.replace(/[\/\\:]/g, '').toLowerCase()
}

if (searchString !== '' || hasSelectFolder) {
const itemPath = normalizePath(item.path)
//only search string
if (!hasSelectFolder) {
return normalizePath(item.path).includes(searchString)
return itemPath.includes(searchString.toLowerCase())
}
//only selected folder
else if (searchString === '') {
return normalizePath(item.path).includes(normalizePath(selectedFolder))
return itemPath.includes(normalizePath(selectedFolder))
}
//both
return (normalizePath(item.path).includes(searchString)
|| normalizePath(item.path).includes(normalizePath(selectedFolder)))
return (itemPath.includes(searchString.toLowerCase())
|| itemPath.includes(normalizePath(selectedFolder)))
}
return true
}
Expand Down Expand Up @@ -338,4 +339,4 @@ export function ExtraNetworksCard({item, searchString, selectedFolder, nsfwFilte

</div>
);
}
}