[mythtv-commits] Ticket #13315: Use fully-decoded URL paths when translating to local paths

MythTV noreply at mythtv.org
Sun Nov 18 14:13:46 UTC 2018


#13315: Use fully-decoded URL paths when translating to local paths
------------------------------+-------------------------------
 Reporter:  ijc               |          Owner:  Peter Bennett
     Type:  Patch - Bug Fix   |         Status:  assigned
 Priority:  minor             |      Milestone:  30.0
Component:  MythTV - General  |        Version:  Master Head
 Severity:  medium            |     Resolution:
 Keywords:                    |  Ticket locked:  0
------------------------------+-------------------------------

Comment (by ijc):

 So I have added a file with a `%25` in it so I have:
 {{{
 $ ls /var/lib/mythvideo/temp/ticker_1080i%25.mkv
 /var/lib/mythvideo/temp/ticker_1080i%25.mkv
 }}}

 Which is in the database as:
 {{{
 MariaDB [mythconverg]> select title,subtitle,filename from videometadata
 where filename like "%ticker%";
 +-----------------+----------+--------------------------+
 | title           | subtitle | filename                 |
 +-----------------+----------+--------------------------+
 | ticker 1080i%25 |          | temp/ticker_1080i%25.mkv |
 +-----------------+----------+--------------------------+
 1 row in set (0.01 sec)
 }}}

 When playing (without my patches) I see:
 {{{
 mythfrontend[9987]: I CoreContext remotefile.cpp:518 (Exists)
 RemoteFile::Exists(): looking for remote file:
 myth://Videos@iranon/temp/ticker_1080i%25.mkv
 mythfrontend[9987]: I MythSocketThread(-1) mythsocket.cpp:758
 (WriteStringListReal) MythSocket(2891300:36): write -> 36 55
 QUERY_FILE_EXISTS[]:[]temp/ticker_1080i%.mkv[]:[]Videos
 mythfrontend[9987]: I MythSocketThread(-1) mythsocket.cpp:758
 (WriteStringListReal) MythSocket(5222e40:76): write -> 76 191     ANN
 FileTransfer iranon 0 1 2000[]:[]/temp/ticker_1080i%.mkv[]:[]...
 }}}
 and
 {{{
 mythbackend[9874]: I MythSocketThread(96) mythsocket.cpp:959
 (ReadStringListReal) MythSocket(2aced50:96): read  <- 96 55
 QUERY_FILE_EXISTS[]:[]temp/ticker_1080i%.mkv[]:[]Videos
 mythbackend[9874]: E ProcessRequest storagegroup.cpp:622 (FindFile)
 SG(Videos): FindFile: Unable to find 'temp/ticker_1080i%.mkv'!
 mythbackend[9874]: I MythSocketThread(182) mythsocket.cpp:959
 (ReadStringListReal) MythSocket(2ad0fb0:182): read  <- 182 191     ANN
 FileTransfer iranon 0 1 2000[]:[]/temp/ticker_1080i%.mkv[]:[...
 mythbackend[9874]: I ProcessRequest mainserver.cpp:7994 (LocalFilePath)
 MainServer: LocalFilePath(/temp/ticker_1080i%25.mkv 'ticker_1080i%.mkv'),
 found file through exhaustive search at
 '/var/lib/mythvideo//temp/ticker_1080i%25.mkv'
 }}}

 So, I think it looks like something somewhere (on the client side, between
 the log for `RemoteFile::Exists()` and the one for `WriteStringListReal`)
 is decoding the URL escaping in the name and then relying on the code I
 removed to reencode it so it can find the file, which is rather backwards
 (if anything it should be further encoding it to `ticker_1080i%2525.mkv`
 so it can be decoded to `ticker_1080i%25.mkv`).

 I think the code which messes with the encoding is spread through
 `libs/libmythbase/remotefile.{cpp,h}`.

 I think the choices are to try fix the use of `Qurl` in `remotefile.cpp`
 (which must be there in this case because it actually is a URL, so we
 can't just excise it completely) or to roll back to my first attempt here
 which added fixes to the use of QUrl in `mainserver.cpp` etc (e.g.
 ensuring the fragment and query were put back, etc).

 I prefer the first choice (although it might take a bit longer to get
 right). I'm going to have a play right now.

-- 
Ticket URL: <https://code.mythtv.org/trac/ticket/13315#comment:8>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list