- 🇩🇰Denmark nicklasmf
I have an issue where this duplicated hash happens along side using Media Library.
Patch #7 works for me as well.
When removing a file from an entity then uploading one with exactly the same name the following error is produced when trying to save the entity:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'SomeHash' for key 'hash': INSERT INTO {redirect}...
Filefield Paths generates a hash for each redirect it creates and uses it to check if the redirect already exists. Currently Filefield Paths generates this hash using the target or destination path, while the Redirect module uses the source path with the leading slash removed.
This results in Filefield Paths never finding the existing redirect and trying to create a new one.
To resolve this, the module needs to generate a hash the same way as Redirect does. See Drupal\redirect\Entity\Redirect
.
Needs work
1.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I have an issue where this duplicated hash happens along side using Media Library.
Patch #7 works for me as well.