Converting a sound in "/" causes an error
Bug #1087901 reported by
ideasman42
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SoundConverter |
Fix Released
|
Critical
|
GautierPortet |
Bug Description
If I try convert "/a.ogg" its added as "//a.ogg", then when pressing convert I get the error.
Invalid URI: '//a.mp3'
---
This is very simple to redo.
Changed in soundconverter: | |
milestone: | none → 2.1.0 |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Yes, easy to reproduce.
Have had a brief look only:
ui.py add_uris() takes a list of URIs. Here a filename with "file://" prefix, so it starts with "file:///a.ogg" correctly. Further below in the same function, it splits of a "base" value where it gets wrong:
if not base: split(os. path.commonpref ix(files) )
base, notused = os.path.
base += '/'
It here ends up with a base value "file:/" which is wrong. It then uses this base value to create a SoundFile object,
for f in files:
sound_ file = SoundFile(f, base)
where we end up in file soundfile.py where it splits the uri into a base_path and a filename:
if base_path:
self. base_path = base_path
self. filename = self.uri[ len(self. base_path) :]
self. base_path, self.filename = os.path. split(self. uri)
self. base_path += '/'
else:
Obviously, splitting off "file:/" of "file:///a.ogg" results in "//a.ogg".
No idea why it does all that. A brute-force work-around would have been to simply replace a leading '//' from the filename, but interestingly, GStreamer then refused to open the file /a.ogg (because it's owned by root.root, of course), and the --debug output said:
Error: <b>GStreamer Error:</b>
Could not open resource for writing.
<i>(/a.ogg)</i>
Error: <b>GStreamer Error:</b>
Could not open resource for writing.
<i>(/a.ogg)</i>
Cannot set permission on '/a.wav'