From f181a7e459ff8a81dc5910316b55e53bf98f3072 Mon Sep 17 00:00:00 2001 From: hikerpig Date: Tue, 30 Jul 2019 13:50:59 +0800 Subject: [PATCH] more strict regex pattern in pathname matching, fix #3183 --- browser/main/Detail/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/browser/main/Detail/index.js b/browser/main/Detail/index.js index 0ed3dd54..95b9d73d 100644 --- a/browser/main/Detail/index.js +++ b/browser/main/Detail/index.js @@ -50,16 +50,14 @@ class Detail extends React.Component { const searchStr = params.searchword displayedNotes = searchStr === undefined || searchStr === '' ? allNotes : searchFromNotes(allNotes, searchStr) - } - - if (location.pathname.match(/\/tags/)) { + } else if (location.pathname.match(/^\/tags/)) { const listOfTags = params.tagname.split(' ') displayedNotes = data.noteMap.map(note => note).filter(note => listOfTags.every(tag => note.tags.includes(tag)) ) } - if (location.pathname.match(/\/trashed/)) { + if (location.pathname.match(/^\/trashed/)) { displayedNotes = trashedNotes } else { displayedNotes = _.differenceWith(displayedNotes, trashedNotes, (note, trashed) => note.key === trashed.key)