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

Pierre Ynard git at videolan.org
Mon Sep 7 20:07:27 CEST 2020


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

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

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

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

 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