<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
</head>
<body>
<p>Hi Adrian,</p>
<p>I am not sure what the status of this patch set is as I have been away from the mailing-list for quite some time, so if it has already been superseded (I looked but couldn’t find anything) I apologize for the useless reply.</p>
<p>It is also worth noting that your commit messages are formatted weird. On the first line you should be the â€œsubject” line, which should be short, you can later go on and explain the changes in more detail on lines that follow. Do not put everything on the same line.</p>
<p>On 2018-08-30 16:37, Adrian Borkiet wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> ---
  share/lua/extensions/VLSub.lua | 15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)

 diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
 index ee9e5f84a9..720dd08cdc 100644
 --- a/share/lua/extensions/VLSub.lua
 +++ b/share/lua/extensions/VLSub.lua
 @@ -329,8 +329,8 @@ local select_conf = {} -- Drop down widget / option table association

  function descriptor()
    return {
 -    title = "VLsub 0.11.0",
 -    version = "0.11.0",
 +    title = "VLsub 0.11.1",
 +    version = "0.11.1",
      author = "exebetche",
      url = 'http://www.opensubtitles.org/',
      shortdesc = "VLsub";
 @@ -1010,7 +1010,7 @@ openSub = {
      url = "http://api.opensubtitles.org/xml-rpc",
      path = nil,
      userAgentHTTP = "VLSub",
 -    useragent = "VLSub 0.11.0",
 +    useragent = "VLSub 0.11.1",
      translations_avail = {},
      downloadBehaviours = nil,
      languages = languages
 @@ -1437,12 +1437,17 @@ function get_first_sel(list)
    return 0
  end

 -function find_subtitle_in_archive(archivePath, subfileExt)
 +function find_subtitle_in_archive(archivePath, subfileExt, subFileName)
    local archive = vlc.directory_stream(vlc.strings.make_uri(archivePath))
    local items = archive:readdir()
    if not items then
      return nil
    end
 +  for _, item in pairs(items) do
 +    if string.sub(item:uri(), -string.len(subFileName)) == subFileName then</code></pre>
</blockquote>
<p>It might be unlikely, but the above can result in false-positives if the subtitle filename is a suffix of some other file with a longer name. If you have <code>demo-awesome_subtitle.srt</code> and <code>awesome_subtitle.srt</code>, the former could be matched when looking for <code>awesome_subtitle.srt</code>.</p>
<p>In order to fix this issue you must take directory separators into account.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> +      return item:uri()
 +    end
 +  end
    subfileExt = "." .. subfileExt
    for _, item in pairs(items) do
      if string.sub(item:uri(), -string.len(subfileExt)) == subfileExt then</code></pre>
</blockquote>
<p>The above has the same problem, though even less likely to cause issues in practice.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> @@ -1503,7 +1508,7 @@ function download_subtitles()
    end
    vlc.msg.dbg("[VLsub] tmpFileName: "..tmpFileName)

 -  local subtitleMrl = find_subtitle_in_archive(tmpFileName, item.SubFormat)
 +  local subtitleMrl = find_subtitle_in_archive(tmpFileName, item.SubFormat, item.SubFileName)

    if not subtitleMrl then
      setMessage( lang['mess_not_load'] )</code></pre>
</blockquote>
<p>Best Regards,<br />
Filip</p>
</body>
</html>