Closed (fixed)
Project:
Publish content from WoodWing Studio
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2021 at 16:24 UTC
Updated:
13 May 2021 at 15:29 UTC
Jump to comment: Most recent
Comments
Comment #2
berdirMight be easier to just update \Drupal\ww_publish\Image::createMediaEntity() to use \Drupal\Core\File\FileSystemInterface::EXISTS_RENAME instead of REPLACE.
That said, shouldn't the filename always match the ID and already look up the existing media through that? If the ID's are not globally unique then the assumption in \Drupal\ww_publish\Image::getMediaEntity to reuse existing medias would not be correct?
Comment #4
antonín slejška commentedThank You, Sasha. It is the simplest solution.
It is possible to improve it in the future...
Comment #5
berdirWould like to understand the scenario better before adding it to the 2.x branch, it's not clear to me yet how the filename can be the same but the media/file does not exist for it.
Comment #6
antonín slejška commentedHi Sasha,
before the commit: if two different images (in two articles) with the same filename were uploaded, then two media entities were created, but both media entities have been related to (linked) the same file. The first uploaded file was replaced by the second uploaded file. Now it works as expected:
Comment #7
berdirAh, I understand. I thought that the filename is the ID, but I forgot that we are renaming the file based on the name in the metadata, so I see, it could indeed be the same for different IDs. Yeah, this makes sense then. I cherry picked this commit to 2.x.