ukdtom / WebTools.bundle

WebTools is a collection of tools for Plex Media Server. Like the Unsupported AppStore (UAS)
https://forums.plex.tv/discussion/288191
Mozilla Public License 2.0
1.3k stars 170 forks source link

WT 3 - Logs listing shows non-text files #497

Closed JamminR closed 6 years ago

JamminR commented 6 years ago

Environment

Expected behaviour

  1. Item not to appear in listing at best, or not attempt to open, or at least, display message "not a text" or "unreadable" - the file quite clearly exists.

Actual behaviour

  1. Both a .zip file (Fmovies_plus.zip) and a .7z file (PMS Logs.7z) appear at the top, and are automatically selected and attempt to open when selecting the WT3 Logs menu.

Additional Info

2018-03-15 19:16:52,858 (2750) : DEBUG (logkit:13) - Recieved an apiV3 call for module: LOGS for method: GET 2018-03-15 19:16:52,858 (2750) : DEBUG (logkit:13) - Log Root dir is: D:\PlexCache\Plex Media Server\Logs 2018-03-15 19:16:52,858 (2750) : DEBUG (logkit:13) - Function to call is: SHOW with params: ['FMoviePlus_tinkering.zip'] 2018-03-15 19:16:52,858 (2750) : DEBUG (logkit:13) - Log Root dir is: D:\PlexCache\Plex Media Server\Logs 2018-03-15 19:16:52,858 (2750) : DEBUG (logkit:13) - Opening logfile: D:\PlexCache\Plex Media Server\Logs\FMoviePlus_tinkering.zip 2018-03-15 19:16:52,858 (2750) : CRITICAL (core:574) - Fatal error happened in Logs show: [Errno 2] No such file or directory: u'D:\PlexCache\Plex Media Server\Logs\FMoviePlus_tinkering.zip' (most recent call last): File "D:\PlexCache\Plex Media Server\Plug-ins\WebTools.bundle\Contents\Code\logsV3.py", line 307, in SHOW with io.open(file, 'r', errors='ignore') as content_file: IOError: [Errno 2] No such file or directory: u'D:\PlexCache\Plex Media Server\Logs\FMoviePlus_tinkering.zip'

2018-03-15 19:16:52,898 (2750) : DEBUG (logkit:13) - Recieved an apiV3 call for module: LOGS for method: PUT 2018-03-15 19:16:52,898 (2750) : DEBUG (logkit:13) - Log Root dir is: D:\PlexCache\Plex Media Server\Logs 2018-03-15 19:16:52,898 (2750) : DEBUG (logkit:13) - Function to call is: ENTRY with params: None 2018-03-15 19:16:52,898 (2750) : DEBUG (logkit:13) - Starting Logs.entry function 2018-03-15 19:16:52,900 (2750) : DEBUG (logkit:13) - FrontEnd: Location: Logs
Error: logsService.getLogDetails - Fatal error happened in Logs show: [Errno 2] No such file or directory: u'D:\PlexCache\Plex Media Server\Logs\FMoviePlus_tinkering.zip' 2018-03-15 19:17:32,405 (2750) : DEBUG (logkit:13) - Recieved an apiV3 call for module: LOGS for method: GET 2018-03-15 19:17:32,407 (2750) : DEBUG (logkit:13) - Log Root dir is: D:\PlexCache\Plex Media Server\Logs

Checklist

JamminR commented 6 years ago

Bonus points for opening the zip and reading text files in it!!👍

ukdtom commented 6 years ago

That is not going to happen 4 sure, but I'll look into ignoring invalid files in the log directory

ukdtom commented 6 years ago

Fixed by adding a filter, only allowing file ext. as .log or .[integer]