diff --git a/last_commit.txt b/last_commit.txt index 6278f692d6..b46b9ae495 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,80 +1,44 @@ -Repository: plone.protect - - -Branch: refs/heads/master -Date: 2024-09-25T09:35:08+02:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/plone.protect/commit/aca1e8b621c89480dde0c8c337dc771ec49723f9 - -Check for removed tinymce.util.XHR - -Files changed: -M plone/protect/protect.js - -b'diff --git a/plone/protect/protect.js b/plone/protect/protect.js\nindex acd3aed..817b246 100644\n--- a/plone/protect/protect.js\n+++ b/plone/protect/protect.js\n@@ -29,7 +29,7 @@ if(script){\n }\n });\n }\n- if(window.tinymce && window.tinymce.util.XHR._send === undefined){\n+ if(window.tinymce && window.tinymce.util.XHR && window.tinymce.util.XHR._send === undefined){\n window.tinymce.util.XHR._send = window.tinymce.util.XHR.send;\n var xhr = window.tinymce.util.XHR;\n var _send = xhr.send;\n' - -Repository: plone.protect - - -Branch: refs/heads/master -Date: 2024-09-25T09:35:08+02:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/plone.protect/commit/7aac622b021556f6cdc5f98cf626ef9b730e2448 - -changenote - -Files changed: -A news/106.bugfix - -b'diff --git a/news/106.bugfix b/news/106.bugfix\nnew file mode 100644\nindex 0000000..d7fa367\n--- /dev/null\n+++ b/news/106.bugfix\n@@ -0,0 +1,2 @@\n+Remove tinymce patch. `tinymce.utils.XHR` has been removed in TinyMCE 6.\n+[petschki]\n' - -Repository: plone.protect - - -Branch: refs/heads/master -Date: 2024-10-23T16:15:56+02:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/plone.protect/commit/9f3cf436f6ced883b03c73a7416bd63441cc3e21 - -Update plone/protect/protect.js - -Co-authored-by: Johannes Raggam <thetetet@gmail.com> - -Files changed: -M plone/protect/protect.js - -b'diff --git a/plone/protect/protect.js b/plone/protect/protect.js\nindex 817b246..d141cc5 100644\n--- a/plone/protect/protect.js\n+++ b/plone/protect/protect.js\n@@ -30,6 +30,8 @@ if(script){\n });\n }\n if(window.tinymce && window.tinymce.util.XHR && window.tinymce.util.XHR._send === undefined){\n+ // Fix for TinyMCE < 6 in Plone < 6.1\n+ // TODO: Can be removed in Plone 6.1\n window.tinymce.util.XHR._send = window.tinymce.util.XHR.send;\n var xhr = window.tinymce.util.XHR;\n var _send = xhr.send;\n' - -Repository: plone.protect - - -Branch: refs/heads/master -Date: 2024-10-28T10:43:03+01:00 -Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/plone.protect/commit/80a9b99932a428c459e8db9cad129b01f1e982a5 - -Merge branch 'master' into tinymce-fix - -Files changed: -M .pre-commit-config.yaml - -b'diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml\nindex 1460326..f70417d 100644\n--- a/.pre-commit-config.yaml\n+++ b/.pre-commit-config.yaml\n@@ -16,7 +16,7 @@ repos:\n hooks:\n - id: isort\n - repo: https://github.com/psf/black\n- rev: 24.8.0\n+ rev: 24.10.0\n hooks:\n - id: black\n - repo: https://github.com/collective/zpretty\n' - -Repository: plone.protect - - -Branch: refs/heads/master -Date: 2024-10-28T10:44:32+01:00 -Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/plone.protect/commit/dab69f6cca215051cba84e3c6e638bcb36820fb3 - -Merge pull request #118 from plone/tinymce-fix - -TinyMCE 6+ support +Repository: plone.restapi + + +Branch: refs/heads/main +Date: 2024-10-30T13:43:55-07:00 +Author: Teodor Voicu (tedw87) <104510089+tedw87@users.noreply.github.com> +Commit: https://github.com/plone/plone.restapi/commit/b9ca1f9afa2d26193df8513f14cb159a2a83a012 + +Handle parentheses search queries (#1828) + +* escape parantheses in query + +* reformat code + +* add changelog + +* Update news/1828.bugfix + +Co-authored-by: Steve Piercy <web@stevepiercy.com> + +* Update src/plone/restapi/search/handler.py + +Co-authored-by: Steve Piercy <web@stevepiercy.com> + +* add tests for searching with parantheses + +* format code + +* run black to format code + +* Update news/1828.bugfix + +--------- + +Co-authored-by: Steve Piercy <web@stevepiercy.com> +Co-authored-by: David Glick <david@glicksoftware.com> Files changed: -A news/106.bugfix -M plone/protect/protect.js +A news/1828.bugfix +M src/plone/restapi/search/handler.py +M src/plone/restapi/tests/test_search.py -b'diff --git a/news/106.bugfix b/news/106.bugfix\nnew file mode 100644\nindex 0000000..d7fa367\n--- /dev/null\n+++ b/news/106.bugfix\n@@ -0,0 +1,2 @@\n+Remove tinymce patch. `tinymce.utils.XHR` has been removed in TinyMCE 6.\n+[petschki]\ndiff --git a/plone/protect/protect.js b/plone/protect/protect.js\nindex acd3aed..d141cc5 100644\n--- a/plone/protect/protect.js\n+++ b/plone/protect/protect.js\n@@ -29,7 +29,9 @@ if(script){\n }\n });\n }\n- if(window.tinymce && window.tinymce.util.XHR._send === undefined){\n+ if(window.tinymce && window.tinymce.util.XHR && window.tinymce.util.XHR._send === undefined){\n+ // Fix for TinyMCE < 6 in Plone < 6.1\n+ // TODO: Can be removed in Plone 6.1\n window.tinymce.util.XHR._send = window.tinymce.util.XHR.send;\n var xhr = window.tinymce.util.XHR;\n var _send = xhr.send;\n' +b'diff --git a/news/1828.bugfix b/news/1828.bugfix\nnew file mode 100644\nindex 000000000..dfc2a5ef4\n--- /dev/null\n+++ b/news/1828.bugfix\n@@ -0,0 +1 @@\n+`@search` service: Remove parentheses from search query. @tedw87\n\\ No newline at end of file\ndiff --git a/src/plone/restapi/search/handler.py b/src/plone/restapi/search/handler.py\nindex 8764a773d..2a362e05d 100644\n--- a/src/plone/restapi/search/handler.py\n+++ b/src/plone/restapi/search/handler.py\n@@ -75,6 +75,10 @@ def _constrain_query_by_path(self, query):\n path = "/".join(self.context.getPhysicalPath())\n query["path"]["query"] = path\n \n+ def quote_chars(self, query):\n+ # Remove parentheses from the query\n+ return query.replace("(", " ").replace(")", " ").strip()\n+\n def search(self, query=None):\n if query is None:\n query = {}\n@@ -93,6 +97,12 @@ def search(self, query=None):\n if use_site_search_settings:\n query = self.filter_query(query)\n \n+ if "SearchableText" in query:\n+ # Sanitize SearchableText by removing parentheses\n+ query["SearchableText"] = self.quote_chars(query["SearchableText"])\n+ if not query["SearchableText"] or query["SearchableText"] == "*":\n+ return []\n+\n self._constrain_query_by_path(query)\n query = self._parse_query(query)\n \n@@ -100,7 +110,6 @@ def search(self, query=None):\n results = getMultiAdapter((lazy_resultset, self.request), ISerializeToJson)(\n fullobjects=fullobjects\n )\n-\n return results\n \n def filter_types(self, types):\ndiff --git a/src/plone/restapi/tests/test_search.py b/src/plone/restapi/tests/test_search.py\nindex e4ddb4c38..84b6e0b48 100644\n--- a/src/plone/restapi/tests/test_search.py\n+++ b/src/plone/restapi/tests/test_search.py\n@@ -151,6 +151,29 @@ def test_search_on_context_constrains_query_by_path(self):\n set(result_paths(response.json())),\n )\n \n+ def test_search_with_parentheses(self):\n+ query = {"SearchableText": "("}\n+ response = self.api_session.get("/@search", params=query)\n+ self.assertEqual(response.status_code, 200)\n+ self.assertEqual(\n+ response.json(), [], "Expected no items for query with only parentheses"\n+ )\n+\n+ query = {"SearchableText": ")"}\n+ response = self.api_session.get("/@search", params=query)\n+ self.assertEqual(response.status_code, 200)\n+ self.assertEqual(\n+ response.json(), [], "Expected no items for query with only parentheses"\n+ )\n+\n+ query = {"SearchableText": "lorem(ipsum)"}\n+ response = self.api_session.get("/@search", params=query)\n+ self.assertEqual(response.status_code, 200)\n+ items = [item["title"] for item in response.json().get("items", [])]\n+ self.assertIn(\n+ "Lorem Ipsum", items, "Expected \'Lorem Ipsum\' to be found in search results"\n+ )\n+\n def test_search_in_vhm(self):\n # Install a Virtual Host Monster\n if "virtual_hosting" not in self.app.objectIds():\n'