Commit 9090fce8 authored by echel0n's avatar echel0n
Browse files

Added code to unescape ampersand's in show names when adding new or existing...

Added code to unescape ampersand's in show names when adding new or existing shows and when editing existing show location
parent 6c808dee
......@@ -23,7 +23,7 @@ import os
import re
from urllib.parse import unquote_plus, urlencode
from tornado.escape import json_encode
from tornado.escape import json_encode, url_unescape, xhtml_unescape
from tornado.httputil import url_concat
from tornado.web import authenticated
......@@ -84,7 +84,7 @@ class SearchSeriesProviderForShowNameHandler(BaseHandler):
# search via series name
series_provider =[SeriesProviderID[series_provider_id]]
series_results =, language=series_provider_language)
series_results =, language=series_provider_language)
if series_results:
for series in series_results:
if not series.get('name', None):
......@@ -111,7 +111,7 @@ class MassAddTableHandler(BaseHandler):
def get(self, *args, **kwargs):
root_dir = self.get_arguments('rootDir')
root_dirs = [unquote_plus(x) for x in root_dir]
root_dirs = [unquote_plus(xhtml_unescape(x)) for x in root_dir]
default_index = int('|')[0])
......@@ -398,18 +398,18 @@ class AddNewShowHandler(BaseHandler):
series_provider_id = series_pieces[1]
series_id = int(series_pieces[3])
show_name = series_pieces[4]
show_name = xhtml_unescape(series_pieces[4])
series_provider_id = provided_series_provider_id or
series_id = int(whichSeries)
if fullShowPath:
show_name = os.path.basename(os.path.normpath(fullShowPath))
show_name = os.path.basename(os.path.normpath(xhtml_unescape(fullShowPath)))
show_name = provided_series_name
show_name = xhtml_unescape(provided_series_name)
# use the whole path if it's given, or else append the show name to the root dir to get the full show path
if fullShowPath:
show_dir = os.path.normpath(fullShowPath)
show_dir = os.path.normpath(xhtml_unescape(fullShowPath))
show_dir = os.path.join(rootDir, sanitize_file_name(show_name))
if add_show_year and not re.match(r'.*\(\d+\)$', show_dir) and'\d{4}', series_pieces[5]):
......@@ -495,7 +495,7 @@ class AddExistingShowsHandler(BaseHandler):
prompt_for_settings = self.get_argument('promptForSettings')
# grab a list of other shows to add, if provided
shows_to_add = [unquote_plus(x) for x in shows_to_add]
shows_to_add = [unquote_plus(xhtml_unescape(x)) for x in shows_to_add]
prompt_for_settings = checkbox_to_value(prompt_for_settings)
......@@ -21,7 +21,7 @@
import os
from functools import cmp_to_key
from tornado.escape import json_encode, json_decode
from tornado.escape import json_encode, json_decode, xhtml_unescape
from tornado.web import authenticated
import sickrage
......@@ -249,9 +249,11 @@ def edit_show(series_id, any_qualities, best_qualities, exceptions_list, locatio
show_obj.rls_require_words = rls_require_words.strip()
show_obj.search_delay = int(search_delay)
location = os.path.normpath(xhtml_unescape(location))
# if we change location clear the db of episodes, change it, write to db, and rescan
if os.path.normpath(show_obj.location) != os.path.normpath(location): + " != " + os.path.normpath(location))
if os.path.normpath(show_obj.location) != location: + " != " + location)
if not os.path.isdir(location) and not
warnings.append("New location {} does not exist".format(location))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment