File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,9 @@ def _get_asset_from_path(self, path):
536536 base_path = self ._parent .namescope .get (
537537 constants .BASEPATH , constants .ASSETDIR_NAMESPACE
538538 )
539- full_path = os .path .join (base_path , path ) if base_path else path
539+ full_path = (
540+ os .path .normpath (os .path .join (base_path , path )) if base_path else path
541+ )
540542
541543 # Look in the dict of pre-loaded assets before checking the filesystem.
542544 if path in self ._parent .namescope .assets :
Original file line number Diff line number Diff line change @@ -456,9 +456,9 @@ def testFileFromAssetsDict(self):
456456 def testFileFromAssetsDictWithBasepath (self ):
457457 prefix = 'fake_filename'
458458 extension = '.whatever'
459- path = 'invalid/path/' + prefix + extension
459+ path = 'invalid/../ path/' + prefix + extension
460460 contents = 'Fake contents'
461- assets = {os .path .join (ASSETS_DIR , path ): contents }
461+ assets = {os .path .normpath ( os . path . join (ASSETS_DIR , path ) ): contents }
462462 mujoco = element .RootElement (assets = assets )
463463 mujoco .files .text_path = ASSETS_DIR
464464 text_file = mujoco .files .add ('text' , file = path )
You can’t perform that action at this time.
0 commit comments