mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 16:52:38 +00:00
wrap encodeURI in try catch
This commit is contained in:
@@ -380,7 +380,15 @@ const EditPage = createClass({
|
|||||||
|
|
||||||
**[Homebrewery Link](${global.config.publicUrl}/share/${shareLink})**`;
|
**[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(){
|
renderNavbar : function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user