Repository: lutris/lutris

Issue:
Lutris cannot find a submited file on `file:N/A` if it has brackets on its name
### Bug description

While using `file: N/A:Please select the .zip archive.`, if the supplied file has a name that contains brackets, that is, the characters `[` and `]`, it will fail saying the file "does not exist", even if it does exist.

If before doing it, the filename is renamed and the brackets are removed, then it works fine. 

If the file is cached, then it is cached with the filename with brackets, and it will be necessary to rename the file inside the cache dir to remove the brackets, or completely delete it from the cache. Otherwise it will still complain that the file does not exist.

### How to Reproduce

Steps to reproduce the behavior:
1. On any installer that request the user for a file, submit a file that contains brackets on its name.
Something like `Game [English].zip`.

That will fail.

### Expected behavior

Having brackets in the filename should not break an installation.

### Log output

```shell
INFO     2022-01-04 02:24:20,008 [startup.check_driver:53]:Using NVIDIA drivers 495.46 for x86_64
INFO     2022-01-04 02:24:20,008 [startup.check_driver:57]:GPU: Unknown
INFO     2022-01-04 02:24:20,008 [startup.check_driver:73]:GPU: 10DE:1B06 19DA:4471 (nvidia drivers)
DEBUG    2022-01-04 02:24:20,251 [lutriswindow.update_store:451]:Showing 15 games
2022-01-04 02:24:58,317: Using NVIDIA drivers 495.46 for x86_64
2022-01-04 02:24:58,317: GPU: Unknown
2022-01-04 02:24:58,317: GPU: 10DE:1B06 19DA:4471 (nvidia drivers)
2022-01-04 02:24:58,334: Fetching installer https://lutris.net/api/installers/arias-story-itchio
2022-01-04 02:24:58,334: GET https://lutris.net/api/installers/arias-story-itchio
2022-01-04 02:24:58,682: Showing window <class 'lutris.gui.installerwindow.InstallerWindow'>arias-story
2022-01-04 02:25:06,060: Retrieving video modes from XrandR
2022-01-04 02:25:07,995: Getting runner information for wine
2022-01-04 02:25:07,995: GET https://lutris.net/api/runners/wine
2022-01-04 02:25:08,348: Default wine version is lutris-fshack-6.21-6
2022-01-04 02:25:08,352: Files are ready? False
2022-01-04 02:25:08,354: Creating destination path /home/chrll/Games/arias-story
2022-01-04 02:25:22,686: Files are ready? True
2022-01-04 02:25:22,686: Files are ready: True
2022-01-04 02:25:34,387: file is available
2022-01-04 02:25:34,387: All files available
2022-01-04 02:25:34,388: All files are available, continuing install
2022-01-04 02:25:34,388: Installer command: {'task': {'arch': 'win32', 'name': 'create_prefix', 'prefix': '$GAMEDIR'}}
2022-01-04 02:25:34,389: Creating a win32 prefix in /home/chrll/Games/arias-story
2022-01-04 02:25:34,390: Executing /home/chrll/.local/share/lutris/runners/wine/lutris-fshack-6.21-6-x86_64/bin/wineboot
2022-01-04 02:25:34,390: WINEARCH=win32 WINEPREFIX=/home/chrll/Games/arias-story WINEDLLOVERRIDES=winemenubuilder=
2022-01-04 02:25:40,178: win32 Prefix created in /home/chrll/Games/arias-story
2022-01-04 02:25:40,181: Couldn't load shell folder name for Desktop
2022-01-04 02:25:40,182: Couldn't load shell folder name for Personal
2022-01-04 02:25:40,183: Couldn't load shell folder name for My Music
2022-01-04 02:25:40,184: Couldn't load shell folder name for My Videos
2022-01-04 02:25:40,185: Couldn't load shell folder name for My Pictures
2022-01-04 02:25:40,186: Installer command: {'extract': {'dst': '$GAMEDIR/drive_c/Program Files/Aria', 'file': '$file'}}
2022-01-04 02:25:40,187: /home/chrll/Aria's Story 2.0 [English].zip does not exist
None
2022-01-04 02:25:40,187: Error while completing task <bound method CommandsMixin.extract of <interpreter.ScriptInterpreter object at 0x7fc04c2eefc0 (lutris+installer+interpreter+ScriptInterpreter at 0x55bc810ade20)>>: <class 'lutris.installer.errors.ScriptingError'> /home/chrll/Aria's Story 2.0 [English].zip does not exist
None
2022-01-04 02:25:52,171: Cancelling installation of Aria's Story
2022-01-04 02:25:52,172: Killing all wine processes: ['/home/chrll/.local/share/lutris/runners/wine/lutris-fshack-6.21-6-x86_64/bin/wineserver', '-k']
2022-01-04 02:25:52,172: 	Wine prefix: /home/chrll/Games/arias-story
2022-01-04 02:25:52,172: 	Wine arch: win32
2022-01-04 02:25:52,173: Waiting for wine processes to terminate
2022-01-04 02:25:52,173: Done waiting.
2022-01-04 02:25:52,173: Removing folder /home/chrll/Games/arias-story
2022-01-04 02:25:52,174: Removing folder /home/chrll/.cache/lutris/installer/arias-story
2022-01-04 02:25:52,174: Removed window <class 'lutris.gui.installerwindow.InstallerWindow'>arias-story
2022-01-04 02:26:06,014: Shutting down Lutris
```


### System Information

```shell
[System]
OS:              Arch Linux rolling n/a
Arch:            x86_64
Kernel:          5.15.12-arch1-1
Desktop:         Not found
Display Server:  x11

[CPU]
Vendor:          AuthenticAMD
Model:           AMD Ryzen 9 3900X 12-Core Processor
Physical cores:  12
Logical cores:   24

[Memory]
RAM:             15.6 GB
Swap:            16.0 GB

[Graphics]
Vendor:          NVIDIA Corporation
OpenGL Renderer: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
OpenGL Version:  4.6.0 NVIDIA 495.46
OpenGL Core:     4.6.0 NVIDIA 495.46
OpenGL ES:       OpenGL ES 3.2 NVIDIA 495.46
Vulkan:          Supported
```


### Media (optional)

_No response_

### Checklist:

- [X] I'm not asking for support with a game or the wine runner.
- [X] I have followed the above mentioned guides and have all the graphics and wine dependencies installed.
- [X] I have checked for existing issues that describe my problem prior to opening this one.
- [X] I understand that improperly formatted bug reports may be closed without explanation.


Discussion:

Resolving patch:
diff --git a/lutris/installer/commands.py b/lutris/installer/commands.py
--- a/lutris/installer/commands.py
+++ b/lutris/installer/commands.py
@@ -158,7 +158,10 @@ def extract(self, data):
         src_param = data.get("file") or data.get("src")
         filespec = self._get_file(src_param)
 
-        filenames = glob.glob(filespec)
+        if os.path.exists(filespec):
+            filenames = [filespec]
+        else:
+            filenames = glob.glob(filespec)
 
         if not filenames:
             raise ScriptingError(_("%s does not exist") % filespec)


Test patch: