From 231720995961625f56d8a2e477693251fa30a285 Mon Sep 17 00:00:00 2001 From: Aga Date: Fri, 16 Jun 2023 12:56:02 +0100 Subject: [PATCH 1/6] add match for fragment identifier to the http url regex --- portality/regex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portality/regex.py b/portality/regex.py index c50f053f7f..7c5773855d 100644 --- a/portality/regex.py +++ b/portality/regex.py @@ -17,7 +17,7 @@ BIG_END_DATE_COMPILED = re.compile(BIG_END_DATE) #~~URL:Regex~~ -HTTP_URL = r'^https?://([^/:]+\.[a-z]{2,63}|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]+)?(\/.*)?$' +HTTP_URL = r'^https?://([^/:]+\.[a-z]{2,63}|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]+)?(\/.*)?(#.*)?$' HTTP_URL_COMPILED = re.compile(HTTP_URL, re.IGNORECASE) From be55e81cf7711f766b254805f54840e4539eaf6b Mon Sep 17 00:00:00 2001 From: Aga Date: Fri, 7 Jul 2023 12:14:35 +0100 Subject: [PATCH 2/6] add ut for url regex --- doajtest/fixtures/urls.py | 12 ++++++++++++ doajtest/unit/test_regexes.py | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 doajtest/fixtures/urls.py diff --git a/doajtest/fixtures/urls.py b/doajtest/fixtures/urls.py new file mode 100644 index 0000000000..9329859439 --- /dev/null +++ b/doajtest/fixtures/urls.py @@ -0,0 +1,12 @@ +VALID_URL_LISTS = [ + "https://www.sunshine.com", + "http://www.moonlight.com", + "https://www.cosmos.com#galaxy", + "https://www.cosmos.com/galaxy", + "https://www.cosmos.com/galaxy#peanut" +] + +INVALID_URL_LISTS = [ + "ht:www", + "nonexistent.com" +] \ No newline at end of file diff --git a/doajtest/unit/test_regexes.py b/doajtest/unit/test_regexes.py index c8f41b887e..8f3fcb435a 100644 --- a/doajtest/unit/test_regexes.py +++ b/doajtest/unit/test_regexes.py @@ -1,9 +1,9 @@ """ Gather and test DOAJ regexes here """ from doajtest.helpers import DoajTestCase -from doajtest.fixtures import dois, issns +from doajtest.fixtures import dois, issns, urls -from portality.regex import DOI_COMPILED, ISSN_COMPILED +from portality.regex import DOI_COMPILED, ISSN_COMPILED, HTTP_URL_COMPILED import re @@ -41,3 +41,13 @@ def test_02_ISSN_regex(self): for x in issns.INVLAID_ISSN_LIST: assert not issn_regex.match(x), x + + def test_03_URL_regex(self): + """ Check that the URL regex performs correctly. """ + url_regex = HTTP_URL_COMPILED + + for i in urls.VALID_URL_LISTS: + assert url_regex.match(i), i + + for x in urls.INVALID_URL_LISTS: + assert not url_regex.match(x), x From 319fabd1feb049524eb38a3fdd7cabc9cb49f17a Mon Sep 17 00:00:00 2001 From: Aga Date: Tue, 18 Jul 2023 14:08:17 +0100 Subject: [PATCH 3/6] add unit test to cover multiple urls --- doajtest/fixtures/urls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doajtest/fixtures/urls.py b/doajtest/fixtures/urls.py index 9329859439..0e44633849 100644 --- a/doajtest/fixtures/urls.py +++ b/doajtest/fixtures/urls.py @@ -8,5 +8,6 @@ INVALID_URL_LISTS = [ "ht:www", - "nonexistent.com" + "nonexistent.com", + "https://www.doaj.org and https://www.reddit.com" ] \ No newline at end of file From fe10ac695d05f265fd94b00aaa918bc5c5e53931 Mon Sep 17 00:00:00 2001 From: philip Date: Tue, 25 Jul 2023 15:46:18 +0100 Subject: [PATCH 4/6] update better err_msgs --- portality/bll/services/background_task_status.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/portality/bll/services/background_task_status.py b/portality/bll/services/background_task_status.py index eb60ddeaa8..486fdb1d84 100644 --- a/portality/bll/services/background_task_status.py +++ b/portality/bll/services/background_task_status.py @@ -61,7 +61,8 @@ def create_queued_status(self, action, total=2, oldest=1200, **_) -> dict: err_msgs = [] limited_oldest_date = dates.before_now(oldest) if oldest_job and oldest_job.created_timestamp < limited_oldest_date: - err_msgs.append('outdated job found. created_timestamp[{} < {}]'.format( + err_msgs.append('outdated queued job found[{}]. created_timestamp[{} < {}]'.format( + oldest_job.id, oldest_job.created_timestamp, limited_oldest_date )) From 653f4bc98f4d0d0f11182c44cd214df73f51aaa1 Mon Sep 17 00:00:00 2001 From: Aga Date: Mon, 31 Jul 2023 09:53:37 +0100 Subject: [PATCH 5/6] Increase number of results for publishers countries facet to 200 - exceedes the number of countries in the World for today --- portality/static/js/edges/public.journal.edge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portality/static/js/edges/public.journal.edge.js b/portality/static/js/edges/public.journal.edge.js index abb20962f9..47d366d55d 100644 --- a/portality/static/js/edges/public.journal.edge.js +++ b/portality/static/js/edges/public.journal.edge.js @@ -169,7 +169,7 @@ $.extend(true, doaj, { category: "facet", field: "index.country.exact", display: "Publishers' countries", - size: 100, + size: 200, syncCounts: false, lifecycle: "update", updateType: "fresh", From 783842da8ccb206a915ed22b49b8f5e1b63b0f6d Mon Sep 17 00:00:00 2001 From: Steve Eardley Date: Mon, 31 Jul 2023 16:50:44 +0100 Subject: [PATCH 6/6] Version bump for country facet change --- portality/settings.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/portality/settings.py b/portality/settings.py index 9bd5a61d92..152e3ec2d4 100644 --- a/portality/settings.py +++ b/portality/settings.py @@ -9,7 +9,7 @@ # Application Version information # ~~->API:Feature~~ -DOAJ_VERSION = "6.3.9" +DOAJ_VERSION = "6.3.10" API_VERSION = "3.0.1" ###################################### diff --git a/setup.py b/setup.py index 09ee64d48a..571b37f957 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='doaj', - version='6.3.9', + version='6.3.10', packages=find_packages(), install_requires=[ "awscli==1.20.50",