Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.2:Update
python-feedparser
catch-gzip-error.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File catch-gzip-error.patch of Package python-feedparser
diff -ur feedparser-5.2.1-orig/feedparser/feedparser.py feedparser-5.2.1/feedparser/feedparser.py --- feedparser-5.2.1-orig/feedparser/feedparser.py 2015-07-24 12:00:04.000000000 +0700 +++ feedparser-5.2.1/feedparser/feedparser.py 2019-03-31 02:26:41.242238792 +0700 @@ -3865,12 +3869,12 @@ if gzip and 'gzip' in http_headers.get('content-encoding', ''): try: data = gzip.GzipFile(fileobj=_StringIO(data)).read() - except (IOError, struct.error), e: + except (EOFError, IOError, struct.error), e: # IOError can occur if the gzip header is bad. # struct.error can occur if the data is damaged. result['bozo'] = 1 result['bozo_exception'] = e - if isinstance(e, struct.error): + if isinstance(e, (EOFError, struct.error)): # A gzip header was found but the data is corrupt. # Ideally, we should re-request the feed without the # 'Accept-encoding: gzip' header, but we don't. diff -ur feedparser-5.2.1-orig/feedparser/feedparsertest.py feedparser-5.2.1/feedparser/feedparsertest.py --- feedparser-5.2.1-orig/feedparser/feedparsertest.py 2015-07-24 11:45:09.000000000 +0700 +++ feedparser-5.2.1/feedparser/feedparsertest.py 2019-03-31 04:02:14.470216076 +0700 @@ -448,7 +456,7 @@ def test_gzip_struct_error(self): f = feedparser.parse('http://localhost:8097/tests/compression/gzip-struct-error.gz') self.assertEqual(f.bozo, 1) - self.assertTrue(isinstance(f.bozo_exception, struct.error)) + self.assertTrue(isinstance(f.bozo_exception, (EOFError, struct.error))) def test_zlib_good(self): f = feedparser.parse('http://localhost:8097/tests/compression/deflate.z') self.assertEqual(f.version, 'atom10')
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor