Fix PureError if file cannot be detected

Review Request #14296 — Created Jan. 17, 2025 and submitted

Information

RBTools
release-5.x

Reviewers

puremagic seems to throw an exception if the file cannot
be detected instead of just "application/octet-stream".

rbtools/utils/mimetypes.py", line 139, in guess_mimetype
    types = puremagic.magic_string(data)
puremagic/main.py", line 341, in magic_string
    info = _identify_all(head, foot, ext)
puremagic/main.py", line 196, in _identify_all
    return _confidence(matches, ext)
puremagic/main.py", line 137, in _confidence
    raise PureError("Could not identify file")

 
Summary ID
Fix PureError if file cannot be detected
puremagic seems to throw an exception if the file cannot be detected instead of just "application/octet-stream". rbtools/utils/mimetypes.py", line 139, in guess_mimetype types = puremagic.magic_string(data) puremagic/main.py", line 341, in magic_string info = _identify_all(head, foot, ext) puremagic/main.py", line 196, in _identify_all return _confidence(matches, ext) puremagic/main.py", line 137, in _confidence raise PureError("Could not identify file")
6371d56cf11b2d512aa79d3f6bce266f1e61d7e4
david
  1. Ship It!
  2. 
      
misery
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (1d15370)