<div dir="ltr"><div><div>Hi all,<br><br>While looking into bug #1677037 (Powerpoint is slow to load) and trying to add thumbnails to the service files I noticed some issues in the way the service files are currently handled.<br>To illustrate the issues let me provide a few examples:<br><br>**First issue - loss of path**<br>I add some images, media and presentations to the mediamanager from these paths:<br>/home/tgc/1.png<br>/home/tgc/tmp/1.png<br>/home/tgc/testvideo.mp4<br>/home/tgc/tmp/testvideo.mp4<br>/home/tgc/church-presentation.ppt<br>/home/tgc/tmp/church-presentation.ppt<br><br>I then add them to a service and saves it. In that file it is saved with these paths:<br>home/tgc/1.png<br>home/tgc/tmp/1.png<br>home/tgc/testvideo.mp4<br>home/tgc/tmp/testvideo.mp4<br>home/tgc/church-presentation.ppt<br>home/tgc/tmp/church-presentation.ppt<br><br>But when the file is loaded again it is extracted without the paths in the servicemanager folder, like this:<br>1.png<br>testvideo.mp4<br>church-presentation.ppt<br><br>Whoops! We lost half of the files!<br>The obvious fix seems to be to keep the path when extracting.<br><br>**Second issue - loss of drive**<br>I add 2 media files to a service while on Windows:<br>C:\Church\testvideo.mp4<br>D:\Church\testvideo.mp4<br><br>When the files are saved into a service-file where they are saved with these paths:<br>Church\testvideo.mp4<br>Church\testvideo.mp4<br><br>Whoops! We lost the drive! So when extracting the files one will be overwritted - paths or not.<br>A solution could be to prepend the drive as a folder, like this:<br>C\Church\testvideo.mp4<br>D\Church\testvideo.mp4<br><br>**Third issue - case sensitivity**<br>I add 2 media files to a service while on Linux:<br>/home/tgc/Testvideo.mp4<br>/home/tgc/testvideo.mp4<br><br>When the files are saved into a service-file where they are saved with these paths:<br>home/tgc/Testvideo.mp4<br>home/tgc/testvideo.mp4<br><br>I then copy the file to a Windows box and open the file, but since Windows is case insensitive, then one of the files will be overwritten when extracted.<br>A solution could be to append a number to a file if potential clash is detected, like this:<br>home/tgc/Testvideo.mp4<br>home/tgc/testvideo-2.mp4<br><br>So, in conclusion, our current service files loses the filepath and drives and doesn't handle switching case sensitivity. While I admit that these example are not some that are likely to occur very often (if at all), but I still think we need to improve it. While it should be fairly simple to implementing the fixes mentioned above, the question is if there is more yet unknown issues... So maybe a new approach is needed, like the one outlined below...<br><br><br>**Proposal for new service file format**<br>When we add a file to a service file, instead of adding it with its name, we should rename it so its name reflects the sha256 checksum of the filecontent. So is a file is called "church-presentation.ppt" it is saved as "505911856c191c5a7c4a0dc4858a8627e21b7171a1d9189bd8bb39090eac982f.ppt", and no path/folders will be included. The new filename will also be added to the service-item data. Doing this will avoid any problems with paths, and if any files has the same hash it will be because they are the same, so no duplicate content.<br>Avoiding folders from included files also allow us to use folders for something else, namely thumbnails (for presentations). So reusing the the example above, we could create a folder in the servicefile named "505911856c191c5a7c4a0dc4858a8627e21b7171a1d9189bd8bb39090eac982f" which contains all the thumbnails (and slide notes and titles), which can then be reused when loading the servicefile, thereby skipping the step of recreating the thumbnails (and thereby fixing bug #1677037).<br><br>Any thought, ideas, comments?<br><br></div>Best regards,<br></div>Tomas<br></div>