-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nfs] Encode filenames/paths so they end up properly in the db #18311
base: master
Are you sure you want to change the base?
Conversation
Thanks for caring and the PR. Before we can consider this going in however:
This needs to be addressed. A DB migration must be added that fixes the encoding of the preexisting paths. |
xbmc/xbmc/filesystem/NFSFile.cpp Line 267 in eb733a0
|
Bumping it to v20 as v19 entering Beta phase with focus on testing and bug fixes, and this improvement needs more extensive work e.g. db migration and encoding of prexisting paths |
Sorry it took me so long to get back to this :-/ There's still a couple kinks to iron out, but the core pieces should be in place now. Remaining things I have to check:
|
I hate to say it, but on seeing the actual data I am unhappy with changing to have encoded path and filename data stored in the databases. e.g Not only is it is far easy to do db support if these are in a format easily readable by humans, but there are implications for query formation for smart playlists, filtering and searching. These were designed around the path and filename data being a human readable string not an encoded one. I also think there will be knock on effects for JSON API consumers. Both SQLite and MySQL/Maria can store strings like So I am pushing back on this approach, can another solution be found please. |
My thoughts on an alternative approach would be simply changing This has advantage of handling |
I just followed the recommendation from the linked bug report :) Discussions about alternative options seem better at the original bug report, so I'll move the discussion there. |
@DaveTBlake I revisited this, but decided to go back to the original approach. libnfs upstream added support for handling escape characters in URLs, so the URLs kodi stores in the db are now conform to what libnfs would expect. I'm just escaping I'm unescaping the URLs again because kodi doesn't actually use them for anything other than db storage. All libnfs api calls kodi makes require the unescaped paths. |
37ba341
to
e09c7f4
Compare
e178620
to
80f680a
Compare
The return value is exclusively used for direct NFS operations, so it makes more sense to do the decoding centrally here than on every nfs call after.
Description
NFS as a filesystem supports certain special characters (like '?') that are valid within a URL. These characters cause filenames to end up truncated in the db, resulting in invalid video entries in the collection that can't be played (because the path doesn't exist) and get removed again when you clean the library.
I expect this to be still incomplete, but enough to start a conversation. Open points from my side are:
Motivation and Context
This is a fix for #16383. As outlined in the issue comments, the suggested fix was to add proper curl handling to the NFS support. I looked at ZeroconfDirectory as reference implementation and compared it with how NFS works.
The fix, however, introduces a (somewhat breaking) side-effect. Since all paths/filenames are encoded now, when you rescan the NFS share, movies/episodes with special characters in them that were valid before the fix get added again to the library resulting in two working entries where neither will be removed by cleaning the library. Most prominently this affects filenames with spaces in them.
How Has This Been Tested?
I ran kodi locally on my laptop and connected it to my NFS share on a Synology NAS. In that share I had a movie with special characters in both the folder name as well as the file name:
Stermann & Grissemann - Wollt Ihr das totale Sieb?!/Stermann & Grissemann - Wollt Ihr das totale Sieb?!.mkv
Verified that master puts a truncated path in the sqlite db, and a correct path after the fix.
Verified playing from library works after the fix.
Verified direct play from NFS works both before and after the fix.
Verified clean library behavior.
Screenshots (if appropriate):
Types of change
Checklist: