Prevent file duplicates
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3530328. -->
Reported by: [andras_szilagyi](https://www.drupal.org/user/1217938)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Before we used FileExists:Replace when moving the files, but that opened the possibility of conflicts with file indexes. So we moved to FileExists:Rename. Now the issue is with duplicate files, here is what happenes:<br>
When moving a file from A -> B the source (file in A) is not deleted because of FileRepository::move()L190 </p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ol>
<li>setup a file filed with /file-visibiity starting its upload path</li>
<li>save it as draft</li>
<li>publish it</li>
<li>check the filesystem, you should see the same file in 2 locations</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>implement hook_file_move</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue