From 61347ecf04705a1f7af33aeec469e948b81ff3f5 Mon Sep 17 00:00:00 2001 From: frederik Date: Sat, 7 Sep 2024 10:56:20 +0200 Subject: [PATCH 1/2] fix: remove apostrophe from common name like php code does --- scripts/plotly_streamlit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.py index 8d8e584..b122703 100755 --- a/scripts/plotly_streamlit.py +++ b/scripts/plotly_streamlit.py @@ -364,7 +364,7 @@ if daily is False: recording = st.selectbox('Available recordings', recordings.sort_index(ascending=False)) date_specie = df2.loc[df2['File_Name'] == recording, ['Date', 'Com_Name']] date_dir = date_specie['Date'].values[0] - specie_dir = date_specie['Com_Name'].values[0].replace(" ", "_") + specie_dir = date_specie['Com_Name'].values[0].replace(" ", "_").replace("'", "") st.image(userDir + '/BirdSongs/Extracted/By_Date/' + date_dir + '/' + specie_dir + '/' + recording + '.png') st.audio(userDir + '/BirdSongs/Extracted/By_Date/' + date_dir + '/' + specie_dir + '/' + recording) except Exception: From 3dc8b6db389bc3c64af721df00fcf5f0a9a8b740 Mon Sep 17 00:00:00 2001 From: frederik Date: Sat, 14 Sep 2024 10:20:16 +0200 Subject: [PATCH 2/2] fix: properly decode species so apostrophe in the name survives the url encode --- scripts/stats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/stats.php b/scripts/stats.php index c099293..06fff9d 100644 --- a/scripts/stats.php +++ b/scripts/stats.php @@ -36,7 +36,7 @@ if(isset($_GET['sort']) && $_GET['sort'] == "occurrences") { if(isset($_GET['species'])){ - $selection = $_GET['species']; + $selection = htmlspecialchars_decode($_GET['species'], ENT_QUOTES); $statement3 = $db->prepare("SELECT Com_Name, Sci_Name, COUNT(*), MAX(Confidence), File_Name, Date, Time from detections WHERE Com_Name = \"$selection\""); ensure_db_ok($statement3); $result3 = $statement3->execute();