[vlc-commits] youtube.lua: fix escaped '\r' in description metadata

Pierre Ynard git at videolan.org
Mon Sep 7 20:15:38 CEST 2020


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon Sep  7 20:05:27 2020 +0200| [c552d4d64372d7fa5d0661748f4d1038345fe251] | committer: Pierre Ynard

youtube.lua: fix escaped '\r' in description metadata

The description field sometimes somehow even contains mixed LF and CRLF.

(cherry picked from commit ff152eafc353c5c974b98f5e2ff9f6947a67529f)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c552d4d64372d7fa5d0661748f4d1038345fe251
---

 share/lua/playlist/youtube.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 2b560ac9e1..e698974513 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -334,9 +334,12 @@ function parse()
                 description = string.match( line, '\\"shortDescription\\":\\"(.-[^\\])\\"')
                 if description then
                     -- FIXME: do this properly (see #24958)
+                    -- This way of unescaping is technically wrong
+                    -- so as little as possible of it should be done
                     description = string.gsub( description, '\\(["\\/])', '%1' )
                     description = string.gsub( description, '\\(["\\/])', '%1' )
                     description = string.gsub( description, '\\n', '\n' )
+                    description = string.gsub( description, '\\r', '\r' )
                     description = string.gsub( description, "\\u0026", "&" )
                 end
             end



More information about the vlc-commits mailing list