Fix of issue 3625 for path with ASCII characters. Working on the problem with non ASCII characters.

svn: r14413
This commit is contained in:
Peter Landgren 2010-02-20 09:20:12 +00:00
parent 21cf179918
commit 5e8efc14f7

View File

@ -51,6 +51,7 @@ from gui.views.listview import ListView
from gui.views.treemodels import MediaModel from gui.views.treemodels import MediaModel
import ThumbNails import ThumbNails
import const import const
import constfunc
import config import config
import Utils import Utils
import Bookmarks import Bookmarks
@ -205,6 +206,13 @@ class MediaView(ListView):
if not gen.mime.is_valid_type(mime): if not gen.mime.is_valid_type(mime):
return return
photo = gen.lib.MediaObject() photo = gen.lib.MediaObject()
#If in Windows, the url from urlparse.urlparse(d) above is incorrect
# It leaves a "/" first in the url and this is not a valid Windows path/file name.
if constfunc.win():
if name[0] == "/":
name = name[1:]
# Then replace all %20 with a space
name = name.replace('%20',' ')
photo.set_path(name) photo.set_path(name)
photo.set_mime_type(mime) photo.set_mime_type(mime)
basename = os.path.basename(name) basename = os.path.basename(name)