summaryrefslogtreecommitdiffstats
path: root/common/domain
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-07 00:01:54 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-07 00:01:54 +0100
commit88a0c750a80e6efb207877cac73144266e62d5ff (patch)
treefef58a156cc7dbb23dff8ccdfbcf13a7fb3ed467 /common/domain
parent57445759ee3c26dd03aa8292be3187685a424c1d (diff)
downloadsink-88a0c750a80e6efb207877cac73144266e62d5ff.tar.gz
sink-88a0c750a80e6efb207877cac73144266e62d5ff.zip
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.
Diffstat (limited to 'common/domain')
-rw-r--r--common/domain/applicationdomaintype.cpp6
1 files changed, 2 insertions, 4 deletions
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
115 for (const auto &property : propertiesToCopy) { 115 for (const auto &property : propertiesToCopy) {
116 const auto value = buffer.getProperty(property); 116 const auto value = buffer.getProperty(property);
117 if (copyBlobs && value.canConvert<BLOB>()) { 117 if (copyBlobs && value.canConvert<BLOB>()) {
118 auto oldPath = value.value<BLOB>().value; 118 const auto oldPath = value.value<BLOB>().value;
119 //FIXME: This is neither pretty nor save if we have multiple modifications of the same property (the first modification will remove the file). 119 const auto newPath = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString();
120 //At least if the modification fails the file will be removed once the entity is removed.
121 auto newPath = oldPath + "copy";
122 QFile::copy(oldPath, newPath); 120 QFile::copy(oldPath, newPath);
123 memoryAdaptor.setProperty(property, QVariant::fromValue(BLOB{newPath})); 121 memoryAdaptor.setProperty(property, QVariant::fromValue(BLOB{newPath}));
124 } else if (pruneReferences && value.canConvert<Reference>()) { 122 } else if (pruneReferences && value.canConvert<Reference>()) {