diff --git a/Changes.md b/Changes.md index 279feaeede..0b2943c5b2 100644 --- a/Changes.md +++ b/Changes.md @@ -11,6 +11,7 @@ Fixes - Arnold : Fixed bug preventing UI metadata for Imagers from being loaded for Arnold 7.3. - WidgetAlgo : Fixed issue preventing `grab()` from capturing popup menus on Windows. +- ShowURL : Fixed opening of "file://" URLs on Windows (#5861). Documentation ------------- diff --git a/python/GafferUI/ShowURL.py b/python/GafferUI/ShowURL.py index 1b65d204cd..f75249887d 100644 --- a/python/GafferUI/ShowURL.py +++ b/python/GafferUI/ShowURL.py @@ -55,4 +55,11 @@ def showURL( url ) : if opener : os.system( "{0} \"{1}\"".format( opener, url ) ) else : + if sys.platform == "win32" and url.startswith( "file://" ) : + # Windows doesn't let us reliably open "file://" URLs but + # yet has no problem with opening the file itself. This + # means we can't support anchors in file URLs on Windows + # as we need to strip them to produce a valid file path. + url = url[7:].partition( "#" )[0] + QtGui.QDesktopServices.openUrl( QtCore.QUrl( url, QtCore.QUrl.TolerantMode ) )