Resolve the official dated DBLP DTD locally and preserve source encoding
Metadata integrity checks / metadata (push) Successful in 6s

This commit is contained in:
2026-11-06 16:47:08 +08:00
parent 4077cb4666
commit f9bdab49f2
3 changed files with 10 additions and 3 deletions
+6
View File
@@ -34,6 +34,12 @@ class DblpCatalogueTests(unittest.TestCase):
path=self.archive('',doctype='<!DOCTYPE dblp SYSTEM "https://example.org/evil.dtd">')
with self.assertRaisesRegex(ValueError,'pinned external'):list(records(path,self.dtd.read_bytes()))
def test_real_monthly_dtd_name_and_latin1_encoding(self):
path=self.root/'monthly.xml.gz'
xml='<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE dblp SYSTEM "dblp-2023-06-28.dtd"><dblp><inproceedings key="conf/aaai/one"><author>René</author><title>Metadata</title></inproceedings></dblp>'
with gzip.open(path,'wb') as stream:stream.write(xml.encode('latin1'))
self.assertEqual(list(records(path,self.dtd.read_bytes()))[0]['fields']['author'],['René'])
def test_internal_entities_are_rejected(self):
path=self.archive('',doctype='<!DOCTYPE dblp SYSTEM "dblp.dtd" [<!ENTITY x "expanded">]>')
with self.assertRaisesRegex(ValueError,'pinned external'):list(records(path,self.dtd.read_bytes()))