Skip to content

A free, self-hostable news aggregator…

Fix regression sharing links (#9303)

Alexandre Alapetite74092a7fda28
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 74a503fff..32ddc0da0 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -1523,7 +1523,7 @@ function init_stream(stream) {
el = ev.target.closest('.item.share > button[data-type="clipboard"]');
if (el) { // Clipboard
if (navigator.clipboard) {
- navigator.clipboard.writeText(el.dataset.url)
+ navigator.clipboard.writeText(decodeURIComponent(el.dataset.url))
.then(() => {
toggleClass(el, 'ok');
})
@@ -1534,7 +1534,7 @@ function init_stream(stream) {
} else {
// fallback, if navigator.clipboard is not available f.e. if access is not via https or localhost
const inputElement = document.createElement('input');
- inputElement.value = el.dataset.url;
+ inputElement.value = decodeURIComponent(el.dataset.url);
document.body.appendChild(inputElement);
inputElement.select();
if (document.execCommand && document.execCommand('copy')) {
@@ -1552,7 +1552,7 @@ function init_stream(stream) {
el = ev.target.closest('.item.share > button[data-type="web-sharing-api"]');
if (el && navigator.share) { // https://developer.mozilla.org/docs/Web/API/Navigator/share
const shareData = {
- url: el.dataset.url,
+ url: decodeURIComponent(el.dataset.url),
title: decodeURI(el.dataset.title),
};
navigator.share(shareData);
@@ -1569,6 +1569,8 @@ function init_stream(stream) {
if (el) { // Share by POST
const f = el.parentElement.querySelector('form');
f.disabled = false;
+ const input = f.querySelector('input');
+ input.value = decodeURIComponent(input.value);
f.submit();
return false;
}