From 88a0c750a80e6efb207877cac73144266e62d5ff Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 7 Mar 2017 00:01:54 +0100 Subject: Move blob files on move to the same location like when a client moves. Otherwise if the source resource manages to clean up the revision before the target resource gets to process the new entity, then the blob file is gone already. --- common/domain/applicationdomaintype.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index fd88570..99f14a1 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -115,10 +115,8 @@ void copyBuffer(Sink::ApplicationDomain::BufferAdaptor &buffer, Sink::Applicatio for (const auto &property : propertiesToCopy) { const auto value = buffer.getProperty(property); if (copyBlobs && value.canConvert()) { - auto oldPath = value.value().value; - //FIXME: This is neither pretty nor save if we have multiple modifications of the same property (the first modification will remove the file). - //At least if the modification fails the file will be removed once the entity is removed. - auto newPath = oldPath + "copy"; + const auto oldPath = value.value().value; + const auto newPath = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); QFile::copy(oldPath, newPath); memoryAdaptor.setProperty(property, QVariant::fromValue(BLOB{newPath})); } else if (pruneReferences && value.canConvert()) { -- cgit v1.2.3