adsabs / ADSIngestParser

Curation parser library
MIT License
0 stars 7 forks source link

bug: datacite parser can fail when trying to access non-existent tag attributes #33

Open seasidesparrow opened 1 year ago

seasidesparrow commented 1 year ago

Describe the bug The habanero content_negotiation method can return DataCite records in the kernel-4 xml format. The existing datacite parser will fail at L132 if the tag does not have attributes embedded within the tag. The parser will return an IndexError exception when that happens: <code>IndexError: list index out of range</code></p> <p><strong>To Reproduce</strong></p> <ul> <li>Obtain the datacite-xml formatted record via habanero.cn.content_negotiation(ids='10.15468/t4rau8', format='datacite-xml', url='<a rel="noreferrer nofollow" target="_blank" href="https://api.datacite.org">https://api.datacite.org</a>')</li> <li>Parse the record with adsingestp.parsers.datacite.parse(xmldata)</li> </ul> <p><strong>Additional context</strong> Add any other context about the problem here.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>