0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 00:52:48 +00:00

wrap encodeURI in try catch

This commit is contained in:
Víctor Losada Hernández
2024-10-30 22:47:17 +01:00
parent 26afb67f61
commit 2abc2b13f0

View File

@@ -380,7 +380,15 @@ const EditPage = createClass({
**[Homebrewery Link](${global.config.publicUrl}/share/${shareLink})**`;
return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodeURIComponent(title)}&text=${encodeURIComponent(text)}`;
let encodedTitle;
try {
encodedTitle = encodeURIComponent(title);
} catch (error) {
console.error("Error encoding title for Reddit link:", error);
encodedTitle = encodeURIComponent("Check out my homebrew!"); // Fallback title
}
return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodedTitle}&text=${encodeURIComponent(text)}`;
},
renderNavbar : function(){