Skip to content

Commit

Permalink
ShowURL : Improve opening of "file://" URLs on Windows
Browse files Browse the repository at this point in the history
Windows security appears to block us from opening "file://" URLs so instead we just open the file path directly, which Windows seems entirely OK with...

Fixes GafferHQ#5861.
  • Loading branch information
murraystevenson authored and johnhaddon committed Jul 31, 2024
1 parent 9595db9 commit 3a0507a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------
Expand Down
7 changes: 7 additions & 0 deletions python/GafferUI/ShowURL.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )

0 comments on commit 3a0507a

Please sign in to comment.