From 4aeaafee98a4d9dfdd5c5ea94f88e4194bc5281b Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Sat, 20 Nov 2021 20:23:23 +0530 Subject: [PATCH] quarantine: quarantine file on loading additionals: make sure quarantine does not fail on the exit Signed-off-by: Pranam Lashkari Change-Id: I8843ba7e72dc3703c1168b57c9927598bfa5d1f7 --- wsd/DocumentBroker.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 80997df10..4c7cd4398 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -950,7 +950,9 @@ bool DocumentBroker::download(const std::shared_ptr& session, con _uriJailedAnonym = Poco::URI(Poco::URI("file://"), COOLWSD::anonymizeUrl(localPathEncoded)).toString(); _filename = fileInfo.getFilename(); - +#if !MOBILEAPP + Quarantine::quarantineFile(this, _filename); +#endif if (!templateSource.empty()) { // Invalid timestamp for templates, to force uploading once we save-after-loading. @@ -1123,7 +1125,6 @@ void DocumentBroker::handleSaveResponse(const std::string& sessionId, bool succe const std::string oldName = _storage->getRootFilePathToUpload(); const std::string newName = _storage->getRootFilePathUploading(); - Quarantine::quarantineFile(this, _storage->getFileInfo().getFilename() + TO_UPLOAD_SUFFIX); if (rename(oldName.c_str(), newName.c_str()) < 0) { @@ -1137,6 +1138,8 @@ void DocumentBroker::handleSaveResponse(const std::string& sessionId, bool succe { LOG_TRC("Renamed [" << oldName << "] to [" << newName << ']'); } + + Quarantine::quarantineFile(this, Util::splitLast(newName, '/').second); #endif //!MOBILEAPP // Record that we got a response to avoid timing out on saving.