Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Trim the value in case it contains newlines (#2480)

Serafeim Papastefanosfd6ebf75982a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1e98c321e..142d1bc02f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -60,6 +60,7 @@ All notable changes to this project will be documented in this file.
- Restore compatibility with older format of shared links [plausible/analytics#2225](https://github.com/plausible/analytics/pull/2225)
- Fix 'All time' period for sites with no recorded stats [plausible/analytics#2277](https://github.com/plausible/analytics/pull/2277)
- Ensure settings page can be rendered after a form error [plausible/analytics#2278](https://github.com/plausible/analytics/pull/2278)
+- Ensure newlines from settings files are trimmed [plausible/analytics#2480](https://github.com/plausible/analytics/pull/2480)
### Changed
- `script.file-downloads.outbound-links.js` only sends an outbound link event when an outbound download link is clicked
diff --git a/lib/plausible/helpers/config.ex b/lib/plausible/helpers/config.ex
index 4640869ffe..aa28255d03 100644
--- a/lib/plausible/helpers/config.ex
+++ b/lib/plausible/helpers/config.ex
@@ -3,7 +3,7 @@ defmodule Plausible.ConfigHelpers do
var_path = Path.join(config_dir, var_name)
if File.exists?(var_path) do
- File.read!(var_path)
+ File.read!(var_path) |> String.trim()
else
System.get_env(var_name, default)
end