bottlesdevs / Bottles

Run Windows software and games on Linux
https://usebottles.com
GNU General Public License v3.0
6.4k stars 268 forks source link

[BUG] Bottle doesn't work anymore if programs with special in character is installed #1078

Closed bachp closed 2 years ago

bachp commented 2 years ago

Describe the bug When installing an application that contains a special character "®" the corresponding bottle can't be opened anymore and the following message is shown on the console.

Traceback (most recent call last):
  File "/app/share/bottles/bottles/views/list.py", line 149, in show_details
    self.window.show_details_view(config=self.config)
  File "/app/share/bottles/bottles/window.py", line 291, in show_details_view
    self.page_details.set_config(config)
  File "/app/share/bottles/bottles/views/details.py", line 176, in set_config
    self.view_programs.update(config=config)
  File "/app/share/bottles/bottles/views/bottle_programs.py", line 120, in update
    programs = self.manager.get_programs(self.config)
  File "/app/share/bottles/bottles/backend/managers/manager.py", line 633, in get_programs
    executable_path = self.__getLnkData(program)
  File "/app/share/bottles/bottles/backend/managers/manager.py", line 542, in __getLnkData
    return content[-1].decode(decode)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xae in position 23: invalid start byte

The issue seems to be caused by a .lnk file in drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs.

Looking at https://github.com/bottlesdevs/Bottles/blob/master/src/backend/managers/manager.py#L546 the file seems to be decoded as utf-8, which produces garbage. Using Windows-1252 properly decodes the content. See tiptoi® Manager.lnk.zip for the exact content of the .lnk file.

Installation

To Reproduce Steps to reproduce the behavior:

  1. Create a new bottle of type Application or Gaming
  2. Click on 'Run .exe/.msi in this bottle' and select the tiptoi_Manager_Installer.exe and complete the installation process 2a. Alternative to the full installation it is enough to copy the .lnk file from tiptoi® Manager.lnk.zip to drive_c/ProgramData/Microsoft/Windows/Start Menu/Programsin a bottle.
  3. Click on the bottle to open it
  4. Nothing happens and the above mentioned error occures in the console where bottles was launched

Expected behavior The bottle keeps working as it did before the installation.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

mirkobrombin commented 2 years ago

Fixed some commits ago