From: Ardis Lu Date: Thu, 11 Apr 2024 04:31:37 +0000 (-0700) Subject: Handle literal source code content in metadata file X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=d6a65d79d9a4de724ea8fd8eccefbdceb6787853;p=solc-metadata Handle literal source code content in metadata file --- diff --git a/index.html b/index.html index 20066ea..91dde2f 100644 --- a/index.html +++ b/index.html @@ -300,6 +300,13 @@ // Fetch source code if (json?.sources !== undefined) { for (const [file, source] of Object.entries(json.sources)) { + // Source code is literal within the metadata file (i.e., compiler option "useLiteralContent: true") + if (source?.content !== undefined) { + const code = source.content; + logOutput(result, `✅ Successfully fetched source code for "${file}".`, code); + continue; + } + // Source code is linked within metadata file via IPFS try { const cidV0 = source.urls[1].substring(11); const code = await fetchCID(cidV0, ipfs).then(r => r.text());