<table><tr><td style="">wbauer created this revision.<br />wbauer added a reviewer: Amarok.<br />wbauer added a project: Amarok.<br />Herald removed a project: Amarok.<br />Herald added a subscriber: amarok-devel.<br />wbauer requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D24040">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p><tt style="background: #ebebeb; font-size: 13px;">SqlCollectionLocation::moodFile()</tt> tries to replace the filename's extension with ".mood" (and prepend a '.') to get the Url of the moodfile.<br />
But it does that *after* the filename has already been removed from the Url, so <tt style="background: #ebebeb; font-size: 13px;">QUrl::fileName()</tt> gives an empty string and the end result is actually "/path/to/folder/." which depicts the containing folder.</p>
<p>As a result, when Amarok tries to delete the corresponding moodfile after a track is deleted, the whole folder gets deleted instead.</p>
<p>To fix this, save the filename in a temporary variable before removing it, and use that for generating the new filename.</p>
<p>BUG: 411760</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Delete a track from the local collection (right-click->"Delete tracks" or "Move to trash").<br />
Only the selected track gets deleted now, previously it deleted all other files in the containing folder as well.</p>
<p>Debug output I added locally confirms that the generated path is now as expected, i.e. "/path/to/folder/.xxx.mood" instead of "path/to/folder/.".</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R181 Amarok</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D24040">https://phabricator.kde.org/D24040</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/core-impl/collections/db/sql/SqlCollectionLocation.cpp</div></div></div><br /><div><strong>To: </strong>wbauer, Amarok<br /><strong>Cc: </strong>amarok-devel<br /></div>