ID 612726 - Replacing the thumbnail of a Shelf Script that has in its content a file extension supported for thumbnails removes all content between the thumbnail path and the file extension, inclusive

Follow

Problem summary
Replacing the thumbnail of a Shelf Script that has in its content a file extension supported for thumbnails removes all content between the thumbnail path and the file extension, inclusive.
Additionally, importing into the Shelf a script that already has a thumbnail path and one of these file extensions won't load the thumbnail.
 
This also affects any script that uses the functions such as in mari.geo.current() where the file type .cur is found as part of the word "current".
 
Customer reported version
Mari 7.5v1
 
Customer reported platform
Alma 9
 
Steps to reproduce
  1. Create a .py file that includes one of the image file types - such as .cur - in its content, and other words before and after.
     
  2. Import the .py file into a Shelf
     
  3. Add a thumbnail via right-click > Assign Thumbnails
    Note: This will work correctly, and you can right-click > Edit Script to confirm. However, it's worth noting that importing a .py file that already had a thumbnail path won't load the thumbnail for files with an image file path in it.
     
  4. Replace the thumbnail via right-click > Assign Thumbnails
 
Expected behaviour
The thumbnail path should be replaced and the new thumbnail displayed. Just like it does with any script without an image file type in it.
 
Actual behaviour
All content between the thumbnail path and .cur is deleted, including .cur. For example, this Shelf Action:
 
# thumbnail: C:/tmp/MyThumbnail.jpg """ My tooltip """mari.geo.current().save("C:/tmp/object.obj")
 
Becomes:
 
# thumbnail: C:/tmp/MyThumbnail.jpgrent().save("C:/tmp/object.obj")
If there are multiple .cur occurrences, then content is removed up to the last occurrence.

Workaround
  1. Right-click > Edit Script and copy the script
  2. Replace the thumbnail
  3. Right-click > Edit Script and paste the script
  4. Restart Mari
 Alternatively: 
  1. Delete the Script from the shelf
  2. Import it back in, ensuring it doesn't have a thumbnail path
  3. Assign a thumbnail
    As this will be a new thumbnail instead of a replacement, it should work correctly

Reproduced by support
This bug has been reproduced in:
Mari 7.5v1 - Windows 10 - Rocky 9
Mari 6.0v1 - Windows 10
 
Earliest version tested
Mari 6.0v1 - This feature (Shelf Scripts) did not exist before this version
 

    We're sorry to hear that

    Please tell us why