From: saksham1115 Date: Tue, 2 Aug 2016 21:31:59 +0000 (+0000) Subject: Some fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a14f4edc99359ec3d92c4661f85b148226c7a655;p=mediagoblin.git Some fixes --- diff --git a/mediagoblin/plugins/subtitles/tools.py b/mediagoblin/plugins/subtitles/tools.py index f947ba92..d9a5cb38 100644 --- a/mediagoblin/plugins/subtitles/tools.py +++ b/mediagoblin/plugins/subtitles/tools.py @@ -25,11 +25,11 @@ def open_subtitle(path): subtitle_public_filepath = get_path(path) with mg_globals.public_store.get_file( subtitle_public_filepath, 'rb') as subtitle_public_file: - text = subtitle_public_file.read().decode('utf-8') + text = subtitle_public_file.read().decode('utf-8','ignore') return text def save_subtitle(path,text): subtitle_public_filepath = get_path(path) with mg_globals.public_store.get_file( subtitle_public_filepath, 'wb') as subtitle_public_file: - subtitle_public_file.write(text) \ No newline at end of file + subtitle_public_file.write(text) diff --git a/mediagoblin/plugins/subtitles/views.py b/mediagoblin/plugins/subtitles/views.py index b9d82ef3..9bab6ce6 100644 --- a/mediagoblin/plugins/subtitles/views.py +++ b/mediagoblin/plugins/subtitles/views.py @@ -46,7 +46,7 @@ UNSAFE_MIMETYPES = [ @require_active_login def edit_subtitles(request, media): allowed_extensions = ['aqt','gsub','jss','sub','ttxt','pjs','psb', - 'rt','smi','stl','ssf','srt','ssa','ass','usf','vtt','lrc'] + 'rt','smi','rst','stl','ssf','srt','ssa','ass','usf','vtt','lrc'] form = forms.EditSubtitlesForm(request.form) # Add any subtitles @@ -69,7 +69,7 @@ def edit_subtitles(request, media): return redirect(request, location=media.url_for_self(request.urlgen)) - elif filepath.split('.')[:-1] not in allowed_extensions : + elif filepath.split('.')[-1] not in allowed_extensions : messages.add_message( request, messages.ERROR, @@ -163,4 +163,4 @@ def delete_subtitles(request,media): ("Subtitle file deleted!!!")) return redirect(request, - location=media.url_for_self(request.urlgen)) \ No newline at end of file + location=media.url_for_self(request.urlgen))