The current implementation for file type detection in the code is not robust, leading to potential errors under certain conditions. Specifically, the following code segment may result in incorrect file type determination:
https://github.com/marcus-nystrom/Titta/blob/d970df502480d912cf7ed9b0f9221976fff55429/titta/TalkToProLab.py#L326
The issue arises when there are multiple dots (.) in the file name or path. For instance, in the case of C:\Users\MDY\AppData\Local\Temp\tmp435q8bsg.opensesame_pool\test.jpeg, the file_ext variable will contain opensesame_pool\test as the supposed file extension, leading to a "File type not supported" error. This is particularly problematic when working with Titta for Opensesame plugin development.
The recommended fix is to replace file_ext = media_name.split('.')[1] with file_ext = media_name.split('.')[-1]. This modification ensures the correct extraction of the file extension, enhancing the code's robustness. I have already submitted a Pull Request addressing this issue and would appreciate your consideration for acceptance.
The current implementation for file type detection in the code is not robust, leading to potential errors under certain conditions. Specifically, the following code segment may result in incorrect file type determination: https://github.com/marcus-nystrom/Titta/blob/d970df502480d912cf7ed9b0f9221976fff55429/titta/TalkToProLab.py#L326 The issue arises when there are multiple dots (
.
) in the file name or path. For instance, in the case ofC:\Users\MDY\AppData\Local\Temp\tmp435q8bsg.opensesame_pool\test.jpeg
, thefile_ext
variable will containopensesame_pool\test
as the supposed file extension, leading to a "File type not supported" error. This is particularly problematic when working with Titta for Opensesame plugin development.The recommended fix is to replace
file_ext = media_name.split('.')[1]
withfile_ext = media_name.split('.')[-1]
. This modification ensures the correct extraction of the file extension, enhancing the code's robustness. I have already submitted a Pull Request addressing this issue and would appreciate your consideration for acceptance.