Problem/Motivation
I have an entity type with a file_url field. I create a new entity of said type and I fill the file_url field with a remote url. I save the entity, edit it and save it again creating a new revision. A critical error is thrown:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'http://www.example.com' for column 'fid' at row 1: INSERT INTO {file_usage}
This happens because the \Drupal\file_url\Plugin\Field\FieldType\FileUrlFieldItemList class adds file usages on entity updates when a new revision is created, but it doesn't check if the file is a remote one.
Proposed resolution
Add a check to see if the file is remote, like in the other portions of the class.
Remaining tasks
Tests.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2899697-3.patch | 864 bytes | sardara |
Comments
Comment #2
sardara commentedComment #3
sardara commentedComment #4
claudiu.cristeaGood!
Comment #6
claudiu.cristea