veda-consulting-company / uk.co.vedaconsulting.gdpr

Other
11 stars 55 forks source link

Global data policy link renders the base url with language and trailing slash #303

Closed freeform-sg closed 1 year ago

freeform-sg commented 2 years ago

If the site is multilingual, the Data Policy file url is rendered as base_url/language//file_path instead of base_url/file_path, making the file inaccessible.

Example: https://example.com/**en//**sites/default/files/civicrm/persist/contribute/privacy_policy.pdf Instead of https://example.com/sites/default/files/civicrm/persist/contribute/privacy_policy.pdf

I believe the issue is with line 201-202 in CRM/Gdpr/SLA/Utils.php:

$baseUrl = $config->userFrameworkBaseURL;
$url = $baseUrl.$settings['sla_tc'];

Since the url starts with a slash, I don't believe the baseUrl is needed at all in this case. In CRM/Gdpr/SLA/Entity.php, the display of the Terms & Conditions field uses the core v3 api to get the entity, as far as I could tell it's not adding the baseurl for that link (it works as expected), while the data policy field is using the custom function getTermsConditionsUrl().

You would see this by setting the global values and then viewing a contribution form.

The URL is correctly generated on the settings page.