Repository: pymedusa/Medusa

Issue:
{{...}} in release name breaks manual episode search
**Describe the bug**
There is an NZB indexer which appends the password to the release name of each episode. 
The result looks like this: 

> ReleaseName{{ThePassword}}

If the manual epsiode search contains such a result, the body stays blank and the browser console shows following error:

`Something went wrong in getting the paramaters from dom. indexerName: undefined, seriesId: undefined, season: undefined, episode: undefined`  at `snatch-selection.vue:227`

The manual search works on the same indexer if none of the results has a password and thus the release names don't contain curly brackets.

**To Reproduce**
1. Go to a TV Show
2. Click on "Manual Search" for a specific episode
3. Results in an empty page

**Expected behavior**
See a list of search results.

**Screenshots**
![medusa](https://user-images.githubusercontent.com/59095677/71280044-7e3a4c00-235a-11ea-98ba-b9ed95425b64.png)

**Medusa version**
Latest docker image from https://github.com/linuxserver/docker-medusa

Medusa Info:
Branch: master
Commit: Unknown
Version: 0.3.9
Database: 44.14
Python Version:  3.7.5 (default, Oct 17 2019, 12:25:15) [GCC 8.3.0]

**Debug logs**

```
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: 279577: Formatting pattern: %SN - %AD - %EN -> Die Anstalt - 2019 11 05 - Treuhand
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Found codec for Die Anstalt Treuhand
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Parsed /tv/Die Anstalt/Season 06/Die Anstalt S06E07 11-19 into title: Die Anstalt, season: 6, episode: [7], episode_title: 11-19, type: episode, parsing_time: 0.04307889938354492, absolute_episode: [], quality: Unknown, total_time: 0.04324173927307129
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Matched release /tv/Die Anstalt/Season 06/Die Anstalt S06E07 11-19 to a series in your database: Die Anstalt
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Transaction with 3 queries executed
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Mass updating cache table with manual results for provider: Hydra
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Updating item: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}} to cache: hydra
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Using cached parse result for Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}}
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Adding to cache item found in manual search: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}}
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Updating item: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED to cache: hydra
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Using cached parse result for Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Adding to cache item found in manual search: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Updating item: Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}} to cache: hydra
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Using cached parse result for Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}}
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Adding to cache item found in manual search: Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}}
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Transaction with 3 queries executed
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found single episode result Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}} at **********getnzb/api/308519251735629238?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}} at **********getnzb/api/308519251735629238?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Added item: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}} to cache: hydra with url: **********getnzb/api/308519251735629238?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Adding item from search to cache: 'Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{23XXhYzqdB}'
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found single episode result Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED at **********getnzb/api/-2571879803889673688?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED at **********getnzb/api/-2571879803889673688?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Added item: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED to cache: hydra with url: **********getnzb/api/-2571879803889673688?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Adding item from search to cache: 'Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED'
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found single episode result Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}} at **********getnzb/api/-5790992511800115018?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}} at **********getnzb/api/-5790992511800115018?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Added item: Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}} to cache: hydra with url: **********getnzb/api/-5790992511800115018?apikey=**********
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Adding item from search to cache: 'Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{2OwRbg7rS5}'
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Parsed Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}} into title: Die Anstalt, date: 2019-11-05, language: de, source: HDTV, video_codec: H.264, video_encoder: x264, other: Proper, proper_count: 1, proper_tag: REPACK, release_group: ACED, type: episode, parsing_time: 0.03590703010559082, season: 6, episode: [7], absolute_episode: [], quality: SDTV, total_time: 0.03661680221557617
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Matched release Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}} to a series in your database: Die Anstalt
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Database info for series Die Anstalt: Season: 6 Episode(s): [7]
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Series Die Anstalt is air by date
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Parsed Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED into title: Die Anstalt, date: 2019-11-05, language: de, source: HDTV, video_codec: H.264, video_encoder: x264, other: Proper, proper_count: 1, proper_tag: REPACK, release_group: ACED, type: episode, parsing_time: 0.033495426177978516, season: 6, episode: [7], absolute_episode: [], quality: SDTV, total_time: 0.03432965278625488
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Matched release Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED to a series in your database: Die Anstalt
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Database info for series Die Anstalt: Season: 6 Episode(s): [7]
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Series Die Anstalt is air by date
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Parsed Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}} into title: Die Anstalt, date: 2019-11-05, language: de, screen_size: 720p, source: HDTV, video_codec: H.264, video_encoder: x264, release_group: ACED, type: episode, parsing_time: 0.0420839786529541, season: 6, episode: [7], absolute_episode: [], quality: 720p HDTV, total_time: 0.042864084243774414
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Matched release Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}} to a series in your database: Die Anstalt
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Database info for series Die Anstalt: Season: 6 Episode(s): [7]
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Series Die Anstalt is air by date
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found 3 unique search results
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}}
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}}
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: User-Agent: Medusa/0.3.9 (Linux; 4.19.0-0.bpo.6-amd64; 924e9818-2335-11ea-b365-0242993916a0)
2019-12-20 19:35:31 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: GET URL: **********api?t=search&limit=100&offset=0&cat=5000&maxage=3000&apikey=**********&q=Die+Anstalt+2019+11+05 [Status: 200]
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Search show using search string: Die Anstalt 2019 11 05
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Search mode: Episode
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-05-28.GERMAN.720p.HDTV.x264-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-05-28.GERMAN.HDTV.x264-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-07-16.GERMAN.HDTV.x264-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-07-16.GERMAN.720p.HDTV.x264-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-11-05.GERMAN.720p.HDTV.x264-ACED{{2OwRbg7rS5}}
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED{{23XXhYzqdB}}
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-11-05.GERMAN.HDTV.x264.REPACK-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-12-10.GERMAN.HDTV.x264-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Found result: Die.Anstalt.2019-12-10.GERMAN.720p.HDTV.x264-ACED
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: User-Agent: Medusa/0.3.9 (Linux; 4.19.0-0.bpo.6-amd64; 924e9818-2335-11ea-b365-0242993916a0)
2019-12-20 19:35:26 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: GET URL: **********api?t=tvsearch&limit=100&offset=0&cat=5000&maxage=3000&apikey=**********&tvdbid=279577&season=2019&ep=11%2F05 [Status: 200]
2019-12-20 19:35:23 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Search show using search string: indexer_id: {'tvdbid': 279577}
2019-12-20 19:35:23 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Search mode: Episode
2019-12-20 19:35:23 DEBUG	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Could not find any candidates in cache, searching provider.
2019-12-20 19:35:23 INFO	FORCEDSEARCHQUEUE-MANUAL-279577 :: Hydra :: Performing episode search for Die Anstalt
2019-12-20 19:35:23 INFO	FORCEDSEARCHQUEUE-MANUAL-279577 :: Using manual search providers
```




Discussion:
What's the nzb indexer?
Debug logs from the moment you try to load the page?
I added debug Infos.
Indexer is newz-complex  (I suppose they use newznab).
If you can, try replacing line 122 in `themes/dark/templates/snatchSelection.mako`:
https://github.com/pymedusa/Medusa/blob/d0c136d7a528a471b51676140bd35d24d97f65c6/themes/dark/templates/snatchSelection.mako#L122
~with this:~
<details>
<summary>old solution</summary>

```mako
                                     <span data-qtip-my="top left" data-qtip-at="bottom left" :class="getReleaseNameClasses(`${hItem['name']}`)" title="${hItem['name'] | h}" class="break-word ${hItem['name_highlight']} addQTip">${hItem['name'].replace('{', '&lcub;').replace('}', '&rcub;') | h}</span>
```

~What I changed is the last `${hItem['name'] | h}` to:
`${hItem['name'].replace('{', '&lcub;').replace('}', '&rcub;') | h}`~
</details>


---

Actually, a simpler solution is to change the same line to:
```mako
                                     <span data-qtip-my="top left" data-qtip-at="bottom left" :class="getReleaseNameClasses(`${hItem['name']}`)" title="${hItem['name'] | h}" class="break-word ${hItem['name_highlight']} addQTip" v-pre>${hItem['name'] | h}</span>
```
(just added ` v-pre` to the span element)
@sharkykh Thank you! Your solution works well. 

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -105,7 +105,8 @@ def packages():
         'pytest-flake8>=1.0.2',
         'pytest-tornado5>=2.0.0',
         'PyYAML>=5.1',
-        'vcrpy>=2.0.1',
+        'vcrpy<4.0.0 ; python_version < "3.5"',
+        'vcrpy>=4.0.0 ; python_version >= "3.5"',
         'mock>=2.0.0',
     ],
     classifiers=[


Test patch: