wsd: pass uriPublic explicitly to downloadAdvance

Change-Id: I0ac6f32894ada50be59e9801b68a1918affd6a9e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
Ashod Nakashian 2024-03-29 13:25:35 -04:00 committed by Michael Meeks
parent ac589f5563
commit e9591cfa25
2 changed files with 9 additions and 8 deletions

View file

@ -307,7 +307,7 @@ void DocumentBroker::pollThread()
// Download and load the document.
if (_initialWopiFileInfo)
{
downloadAdvance(_childProcess->getJailId(), *_initialWopiFileInfo);
downloadAdvance(_childProcess->getJailId(), _uriPublic, *_initialWopiFileInfo);
_initialWopiFileInfo.reset();
}
@ -781,7 +781,7 @@ void DocumentBroker::stop(const std::string& reason)
_poll->wakeup();
}
bool DocumentBroker::downloadAdvance(const std::string& jailId,
bool DocumentBroker::downloadAdvance(const std::string& jailId, const Poco::URI& uriPublic,
const WopiStorage::WOPIFileInfo& wopiFileInfo)
{
ASSERT_CORRECT_THREAD();
@ -809,12 +809,12 @@ bool DocumentBroker::downloadAdvance(const std::string& jailId,
// Pass the public URI to storage as it needs to load using the token
// and other storage-specific data provided in the URI.
LOG_DBG("Creating new storage instance for URI ["
<< COOLWSD::anonymizeUrl(_uriPublic.toString()) << ']');
LOG_DBG("Creating new storage instance for URI [" << COOLWSD::anonymizeUrl(uriPublic.toString())
<< ']');
try
{
_storage = StorageBase::create(_uriPublic, jailRoot, jailPath.toString(),
_storage = StorageBase::create(uriPublic, jailRoot, jailPath.toString(),
/*takeOwnership=*/isConvertTo());
}
catch (...)
@ -876,7 +876,7 @@ bool DocumentBroker::downloadAdvance(const std::string& jailId,
const StorageBase::FileInfo fileInfo = _storage->getFileInfo();
if (!fileInfo.isValid())
{
LOG_ERR("Invalid fileinfo for URI [" << _uriPublic.toString() << ']');
LOG_ERR("Invalid fileinfo for URI [" << uriPublic.toString() << ']');
return false;
}
@ -890,7 +890,7 @@ bool DocumentBroker::downloadAdvance(const std::string& jailId,
LOG_DBG("Download file for docKey [" << _docKey << ']');
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
std::string localPath = _storage->downloadStorageFileToLocal(
Authorization::create(_uriPublic), *_lockCtx, templateSource);
Authorization::create(uriPublic), *_lockCtx, templateSource);
if (localPath.empty())
{
throw std::runtime_error("Failed to retrieve document from storage");

View file

@ -587,7 +587,8 @@ private:
void refreshLock();
/// Downloads the document ahead-of-time.
bool downloadAdvance(const std::string& jailId, const WopiStorage::WOPIFileInfo& wopiFileInfo);
bool downloadAdvance(const std::string& jailId, const Poco::URI& uriPublic,
const WopiStorage::WOPIFileInfo& wopiFileInfo);
/// Loads a document from the public URI into the jail.
bool download(const std::shared_ptr<ClientSession>& session, const std::string& jailId,