Files with single quotes not deleted out of Music Database (1 Viewer)

hwahrmann

Development Group
  • Team MediaPortal
  • September 15, 2004
    4,624
    2,455
    Vienna, Austria
    Home Country
    Austria Austria
    When using the "File Menu" in My Music to delete a file out of a share and the file name contains a single quote, it gets not deleted from the Music Database.

    Had a quick look at the code and found the problem in DeleteSong of Music\Database.cs.

    When a song gets added the CRC is built on the file name.
    DeleteSong uses this CRC for the search in the database.
    The following statement
    Code:
    DatabaseUtility.RemoveInvalidChars(ref strFileName);

    is translating single quotes in file names to double quotes.
    ....\Who's that girl.mp3 becomes
    ....\Who"s that girl.mp3

    and then the CRC is built with the translated name.
    The problem is that in AddSong the CRC is built on the filename with the single quote.
    So the row to be deleted is never found as the CRC is different.

    Solution is to move:
    Code:
    DatabaseUtility.RemoveInvalidChars(ref strFileName);
    in DeleteSong just a few lines down after the
    Code:
    ulong dwCRC = crc.calc(strFileName);

    tried this on my system and it worked very well.

    Could anyone of the devs apply the changes?

    thx,

    Helmut
     

    Users who are viewing this thread

    Top Bottom