fix for names with quotes or apostrophes
This commit is contained in:
parent
5a35fb0d07
commit
da783c43ba
@ -1394,10 +1394,18 @@ const handleInviteMinter = async (minterName) => {
|
||||
}
|
||||
}
|
||||
|
||||
function escapeForHtmlAttribute(str) {
|
||||
return str
|
||||
.replace(/'/g, ''')
|
||||
.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
const createInviteButtonHtml = (creator, cardIdentifier) => {
|
||||
// Safely escape special chars so they won't break the HTML attribute
|
||||
const safeCreator = escapeForHtmlAttribute(creator);
|
||||
return `
|
||||
<div id="invite-button-container-${cardIdentifier}" style="margin-top: 1em;">
|
||||
<button onclick="handleInviteMinter('${creator}')"
|
||||
<button onclick="handleInviteMinter('${safeCreator}')"
|
||||
style="padding: 10px; background:rgb(0, 109, 76) ; color: white; border: dotted; border-color: white; cursor: pointer; border-radius: 5px;"
|
||||
onmouseover="this.style.backgroundColor='rgb(25, 47, 39) '"
|
||||
onmouseout="this.style.backgroundColor='rgba(7, 122, 101, 0.63) '"
|
||||
|
@ -331,7 +331,8 @@ const getNameInfo = async (name) => {
|
||||
console.log('getNameInfo called')
|
||||
console.log('name:', name)
|
||||
try {
|
||||
const response = await fetch(`${baseUrl}/names/${name}`)
|
||||
// Encode the name for URL safety
|
||||
const response = await fetch(`${baseUrl}/names/${encodeURIComponent(name)}`)
|
||||
|
||||
if (!response.ok) {
|
||||
console.warn(`Failed to fetch name info for: ${name}, status: ${response.status}`)
|
||||
|
Loading…
Reference in New Issue
Block a user