@@ -70,9 +70,6 @@ contract Ethscriptions is ERC721EthscriptionsUpgradeable {
7070 /// @dev Transaction hash => Ethscription data
7171 mapping (bytes32 => Ethscription) internal ethscriptions;
7272
73- // TODO: add full URI to ethscriptions struct return value
74- // TODO: show something for text
75-
7673 /// @dev Content SHA => ContentData (stores actual content and metadata)
7774 mapping (bytes32 => ContentData) public contentBySha;
7875
@@ -635,8 +632,9 @@ contract Ethscriptions is ERC721EthscriptionsUpgradeable {
635632 'const p=" ' , encodedPayload, '"; ' ,
636633 'const m=" ' , mimetype.escapeJSON (), '"; ' , // Escape to prevent breaking out of JS string
637634 'function d(b){try{return decodeURIComponent(atob(b).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))}catch{return null}} ' ,
638- 'const r=d(p)||"";let t=r; ' ,
639- 'try{const j=JSON.parse(r);t=JSON.stringify(j,null,2)}catch{} ' ,
635+ 'const r=d(p);let t=""; ' ,
636+ 'if(r!==null){t=r;try{const j=JSON.parse(r);t=JSON.stringify(j,null,2)}catch{}} ' ,
637+ 'else{t="data:"+m+";base64,"+p} ' , // Reconstruct data URI if UTF-8 decoding fails
640638 'document.getElementById("o").textContent=t||"(empty)"; ' ,
641639 '</script></body></html> '
642640 );
0 commit comments