diff --git a/.gitmodules b/.gitmodules index 251b1c8300..63619033bd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -47,9 +47,6 @@ [submodule "modules/ckanext-sixodp_showcasesubmit"] path = ckan/ckanext/ckanext-sixodp_showcasesubmit url = https://github.com/vrk-kpa/ckanext-sixodp_showcasesubmit.git -[submodule "modules/ckanext-datarequests"] - path = ckan/ckanext/ckanext-datarequests - url = https://github.com/vrk-kpa/ckanext-datarequests.git [submodule "modules/ckanext-organizationapproval"] path = ckan/ckanext/ckanext-organizationapproval url = https://github.com/vrk-kpa/ckanext-organizationapproval.git diff --git a/cdk/lib/ckan-stack.ts b/cdk/lib/ckan-stack.ts index 79c7eb7baa..f30e975c17 100644 --- a/cdk/lib/ckan-stack.ts +++ b/cdk/lib/ckan-stack.ts @@ -152,7 +152,6 @@ export class CkanStack extends Stack { 'dcat_json_interface', 'csw_harvester', 'drupal8', - //'datarequests', 'ytp_organizations', 'ytp_request', 'hierarchy_display', diff --git a/ckan/Dockerfile b/ckan/Dockerfile index bfc4d4bf66..9bde570c0c 100644 --- a/ckan/Dockerfile +++ b/ckan/Dockerfile @@ -318,7 +318,6 @@ COPY ckanext/ckanext-ytp_request ${EXT_DIR}/ckanext-ytp_request/ COPY ckanext/ckanext-ytp_main ${EXT_DIR}/ckanext-ytp_main/ COPY ckanext/ckanext-hierarchy ${EXT_DIR}/ckanext-hierarchy/ COPY ckanext/ckanext-matomo ${EXT_DIR}/ckanext-matomo/ -COPY ckanext/ckanext-datarequests ${EXT_DIR}/ckanext-datarequests/ COPY ckanext/ckanext-harvest ${EXT_DIR}/ckanext-harvest/ COPY ckanext/ckanext-report ${EXT_DIR}/ckanext-report/ COPY ckanext/ckanext-spatial ${EXT_DIR}/ckanext-spatial/ diff --git a/ckan/ckanext/ckanext-advancedsearch/ckanext/advancedsearch/controller.py b/ckan/ckanext/ckanext-advancedsearch/ckanext/advancedsearch/controller.py index d20b28afb1..bdceae305a 100644 --- a/ckan/ckanext/ckanext-advancedsearch/ckanext/advancedsearch/controller.py +++ b/ckan/ckanext/ckanext-advancedsearch/ckanext/advancedsearch/controller.py @@ -96,13 +96,13 @@ def search(): query = get_action('package_search')(context, data_dict) json_query = json.dumps( - {k: v for k, v in list(params_to_dict(request.form).items()) if k != 'page' and type(v) is list and len(v[0]) > 0} + {k: v for k, v in list(params_to_dict(request.form).items()) if k != 'page' and isinstance(v, list) and len(v[0]) > 0} ) filters = { k: v for k, v in list(params_to_dict(request.form).items()) if k != 'search_target' and k != 'search_query' and k != 'page' and k != 'released-before' and k != 'released-after' and k != 'updated-before' - and k != 'updated-after' and k != 'sort' and type(v) is list and len(v[0]) > 0 + and k != 'updated-after' and k != 'sort' and isinstance(v, list) and len(v[0]) > 0 } for key, value in filters.items(): diff --git a/ckan/ckanext/ckanext-datarequests b/ckan/ckanext/ckanext-datarequests deleted file mode 160000 index 0076e25c0c..0000000000 --- a/ckan/ckanext/ckanext-datarequests +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0076e25c0ce434687555e829441cb1f5acf89634 diff --git a/ckan/ckanext/ckanext-harvest b/ckan/ckanext/ckanext-harvest index b251b04ecc..d83d9d71a0 160000 --- a/ckan/ckanext/ckanext-harvest +++ b/ckan/ckanext/ckanext-harvest @@ -1 +1 @@ -Subproject commit b251b04eccb46fb1b75ebc6488c5697460ae76e8 +Subproject commit d83d9d71a079d9526474c6263fc486e81ad3d70c diff --git a/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/cli.py b/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/cli.py index bd464acb8e..1b2a0e435c 100644 --- a/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/cli.py +++ b/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/cli.py @@ -196,13 +196,13 @@ def migrate(ctx, dryrun): resource['description_translated'] = { original_language: resource.get('description', '') or '' } - if resource.get('temporal_granularity') and type(resource.get('temporal_granularity')) is not dict: + if resource.get('temporal_granularity') and not isinstance(resource.get('temporal_granularity'), dict): resource['temporal_granularity'] = { original_language: resource.get('temporal_granularity') } else: del resource['temporal_granularity'] - if resource.get('update_frequency') and type(resource.get('update_frequency')) is not dict: + if resource.get('update_frequency') and not isinstance(resource.get('update_frequency'), dict): resource['update_frequency'] = { original_language: resource.get('update_frequency') } diff --git a/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/dcat.py b/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/dcat.py index 18206df49a..745d21b15f 100644 --- a/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/dcat.py +++ b/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/dcat.py @@ -34,9 +34,9 @@ def as_dict(value): - if type(value) is dict: + if isinstance(value, dict): return value - elif type(value) in (str, six.text_type): + elif isinstance(value, str) or isinstance(value, six.text_type): return as_dict(json.loads(value)) else: raise ValueError() @@ -507,7 +507,7 @@ def graph_from_dataset(self, dataset_dict, dataset_ref): if responsible_party: try: custodians_data = json.loads(responsible_party) - custodians_data = custodians_data if type(custodians_data) is list else [custodians_data] + custodians_data = custodians_data if isinstance(custodians_data, list) else [custodians_data] for custodian_data in custodians_data: custodian = BNode() g.add((custodian, RDF.type, FOAF.Agent)) diff --git a/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/plugin.py b/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/plugin.py index b82604a4d1..aa2285a53c 100644 --- a/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/plugin.py +++ b/ckan/ckanext/ckanext-ytp_main/ckanext/ytp/plugin.py @@ -494,7 +494,7 @@ def before_index(self, pkg_dict): prop_value = json.loads(prop_json) # Add for each language for lang in languages: - if type(prop_value) is dict and prop_value.get(lang): + if isinstance(prop_value, dict) and prop_value.get(lang): prop_value[lang] = [tag for tag in {tag.lower() for tag in prop_value[lang]} if tag not in ignored_tags] pkg_dict['vocab_%s_%s' % (prop_key, lang)] = [tag for tag in prop_value[lang]] pkg_dict[prop_key] = json.dumps(prop_value) diff --git a/ckan/scripts/install_extensions.sh b/ckan/scripts/install_extensions.sh index 4a75b404c3..3ded438f6d 100644 --- a/ckan/scripts/install_extensions.sh +++ b/ckan/scripts/install_extensions.sh @@ -22,7 +22,6 @@ pip_install "${EXT_DIR}/ckanext-ytp_request/requirements.txt" pip_install "${EXT_DIR}/ckanext-ytp_main/requirements.txt" pip_install "${EXT_DIR}/ckanext-hierarchy/requirements.txt" pip_install "${EXT_DIR}/ckanext-matomo/requirements.txt" -pip_install "${EXT_DIR}/ckanext-datarequests/requirements.txt" pip_install "${EXT_DIR}/ckanext-harvest/requirements.txt" pip_install "${EXT_DIR}/ckanext-report/requirements.txt" pip_install "${EXT_DIR}/ckanext-spatial/requirements.txt" @@ -57,7 +56,6 @@ pip_install "${EXT_DIR}/ckanext-ytp_request/pip-requirements.txt" pip_install "${EXT_DIR}/ckanext-ytp_main/pip-requirements.txt" pip_install "${EXT_DIR}/ckanext-hierarchy/pip-requirements.txt" pip_install "${EXT_DIR}/ckanext-matomo/pip-requirements.txt" -pip_install "${EXT_DIR}/ckanext-datarequests/pip-requirements.txt" pip_install "${EXT_DIR}/ckanext-harvest/pip-requirements.txt" pip_install "${EXT_DIR}/ckanext-report/pip-requirements.txt" pip_install "${EXT_DIR}/ckanext-spatial/pip-requirements.txt" @@ -92,7 +90,6 @@ pip install -e ${EXT_DIR}/ckanext-drupal8 \ -e ${EXT_DIR}/ckanext-ytp_main \ -e ${EXT_DIR}/ckanext-hierarchy \ -e ${EXT_DIR}/ckanext-matomo \ - -e ${EXT_DIR}/ckanext-datarequests \ -e ${EXT_DIR}/ckanext-harvest \ -e ${EXT_DIR}/ckanext-report \ -e ${EXT_DIR}/ckanext-spatial \ @@ -130,7 +127,6 @@ pip install -e ${EXT_DIR}/ckanext-drupal8 \ (cd ${EXT_DIR}/ckanext-advancedsearch; python setup.py compile_catalog -f) (cd ${EXT_DIR}/ckanext-scheming; python setup.py compile_catalog -f) (cd ${EXT_DIR}/ckanext-statistics; python setup.py compile_catalog -f) -(cd ${EXT_DIR}/ckanext-datarequests; python setup.py compile_catalog -f) (cd ${EXT_DIR}/ckanext-matomo; python setup.py compile_catalog -f) (cd ${EXT_DIR}/ckanext-ytp_recommendation; python setup.py compile_catalog -f) (cd ${EXT_DIR}/ckanext-apis; python setup.py compile_catalog -f) diff --git a/ckan/templates/production.ini.j2 b/ckan/templates/production.ini.j2 index d9f60e78b2..deb935fabe 100644 --- a/ckan/templates/production.ini.j2 +++ b/ckan/templates/production.ini.j2 @@ -139,8 +139,6 @@ ckanext.sixodp_showcasesubmit.recipient_emails = {{ environ('SYSADMIN_EMAIL') }} ckanext.ytp_recommendation.recaptcha_sitekey = {{ environ('RECAPTCHA_PUBLIC_KEY') }} ckanext.ytp_recommendation.recaptcha_secret = {{ environ('RECAPTCHA_PRIVATE_KEY') }} -ckanext-datarequests.datarequest_notifications_admin_email = None - ckanext.drupal8.site_url = {{ environ('CKAN_DRUPAL_SITE_URL') }} ckanext.drupal8.domain = {{ environ('DOMAIN_NAME') }},{{ environ('SECONDARY_DOMAIN_NAME') }} ckanext.drupal8.sysadmin_role = {{ environ('ROLES_CKAN_ADMIN') }} diff --git a/drupal/modules/avoindata-header/src/Controller/HeaderController.php b/drupal/modules/avoindata-header/src/Controller/HeaderController.php index 90cfda316c..9c19f6b801 100644 --- a/drupal/modules/avoindata-header/src/Controller/HeaderController.php +++ b/drupal/modules/avoindata-header/src/Controller/HeaderController.php @@ -3,6 +3,7 @@ namespace Drupal\avoindata_header\Controller; use Drupal\Core\Controller\ControllerBase; +use Drupal\Core\Url; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Response; @@ -29,7 +30,8 @@ public function header() { $queryParams = \Drupal::request()->query->all(); if (isset($queryParams['activePath'])) { - \Drupal::service('path.current')->setPath($queryParams['activePath']); + $url = Url::fromUserInput($queryParams['activePath']); + \Drupal::service('path.current')->setPath($url->toString()); } $response = new Response(\Drupal::service('renderer')->renderRoot($build)); diff --git a/drupal/modules/avoindata-header/src/Plugin/Form/SearchForm.php b/drupal/modules/avoindata-header/src/Plugin/Form/SearchForm.php index ff857e8ebf..d49679a684 100644 --- a/drupal/modules/avoindata-header/src/Plugin/Form/SearchForm.php +++ b/drupal/modules/avoindata-header/src/Plugin/Form/SearchForm.php @@ -27,6 +27,9 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + // AV-2034: Set form action explicitly to drop query parameters reliably. + $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); + $form['#action'] = sprintf('/%s/api/header', $language); $form['searchfilter'] = [ '#type' => 'textfield', @@ -56,19 +59,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) { $filter = $form_state->getValue('searchfilter'); $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); - $base_path = '/data/%s'; - if ($language === 'en') { - $base_path = sprintf($base_path, 'en_GB'); + $language = 'en_GB'; } - else { - $base_path = sprintf($base_path, $language); - } - - $base_path = $base_path . '/search'; - $base_path = $base_path . '?q=%s'; - $redirect_path = sprintf($base_path, $form_state->getValue('search')); - $url = url::fromUserInput($redirect_path); + $path = sprintf('/data/%s/search', $language); + $url = url::fromUserInput($path, [ + 'query' => ['q' => $form_state->getValue('search')], + ]); $form_state->setRedirectUrl($url); }