mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 09:33:46 +01:00
fix broken symlink crash (#157)
This commit is contained in:
parent
d4d74dd68b
commit
c051df6d91
3 changed files with 13 additions and 1 deletions
3
NEWS
3
NEWS
|
|
@ -41,7 +41,8 @@
|
|||
* Fix a bug where some files would be erroneously interpreted as MP4.
|
||||
* Fix permission bits applied to album art files.
|
||||
* Fix malformed MusicBrainz queries caused by null characters.
|
||||
# Fix a bug with old versions of the Monkey's Audio format.
|
||||
* Fix a bug with old versions of the Monkey's Audio format.
|
||||
* Fix a crash on broken symbolic links.
|
||||
* Retry in more cases when MusicBrainz servers are slow/overloaded.
|
||||
* The old "albumify" plugin for upgrading databases was removed.
|
||||
|
||||
|
|
|
|||
|
|
@ -495,6 +495,8 @@ class MediaFile(object):
|
|||
self.mgfile = mutagen.File(path)
|
||||
except unreadable_exc:
|
||||
raise UnreadableFileError('Mutagen could not read file')
|
||||
except IOError:
|
||||
raise UnreadableFileError('could not read file')
|
||||
|
||||
if self.mgfile is None: # Mutagen couldn't guess the type
|
||||
raise FileTypeError('file type unsupported by Mutagen')
|
||||
|
|
|
|||
|
|
@ -130,6 +130,15 @@ class SafetyTest(unittest.TestCase):
|
|||
self._exccheck('nothing.xml', beets.mediafile.UnreadableFileError,
|
||||
"ftyp")
|
||||
|
||||
def test_broken_symlink(self):
|
||||
fn = os.path.join('rsrc', 'brokenlink')
|
||||
os.symlink('does_not_exist', fn)
|
||||
try:
|
||||
self.assertRaises(beets.mediafile.UnreadableFileError,
|
||||
beets.mediafile.MediaFile, fn)
|
||||
finally:
|
||||
os.unlink(fn)
|
||||
|
||||
class SideEffectsTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.empty = os.path.join('rsrc', 'empty.mp3')
|
||||
|
|
|
|||
Loading…
Reference in a new issue