wsd: reuse getClipboardURI generically
This extracts the sub-path and the tag as parameters, leaving the rest of the logic intact. Change-Id: I4e08537658e14412a1e56b55508ccb9529b00053 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
parent
06d7fd1753
commit
0124b42077
2 changed files with 10 additions and 2 deletions
|
@ -201,16 +201,21 @@ std::string ClientSession::getClipboardURI(bool encode)
|
|||
if (_wopiFileInfo && _wopiFileInfo->getDisableCopy())
|
||||
return std::string();
|
||||
|
||||
return createPublicURI("clipboard", _clipboardKeys[0], encode);
|
||||
}
|
||||
|
||||
std::string ClientSession::createPublicURI(const std::string& subPath, const std::string& tag, bool encode)
|
||||
{
|
||||
Poco::URI wopiSrc = getDocumentBroker()->getPublicUri();
|
||||
wopiSrc.setQueryParameters(Poco::URI::QueryParameters());
|
||||
|
||||
const std::string encodedFrom = Util::encodeURIComponent(wopiSrc.toString());
|
||||
|
||||
std::string meta = _serverURL.getSubURLForEndpoint(
|
||||
"/cool/clipboard?WOPISrc=" + encodedFrom +
|
||||
"/cool/" + subPath + "?WOPISrc=" + encodedFrom +
|
||||
"&ServerId=" + Util::getProcessIdentifier() +
|
||||
"&ViewId=" + std::to_string(getKitViewId()) +
|
||||
"&Tag=" + _clipboardKeys[0]);
|
||||
"&Tag=" + tag);
|
||||
|
||||
if (!encode)
|
||||
return meta;
|
||||
|
|
|
@ -221,6 +221,9 @@ public:
|
|||
/// Create URI for transient clipboard content.
|
||||
std::string getClipboardURI(bool encode = true);
|
||||
|
||||
/// Utility to create a publicly accessible URI.
|
||||
std::string createPublicURI(const std::string& subPath, const std::string& tag, bool encode);
|
||||
|
||||
/// Adds and/or modified the copied payload before sending on to the client.
|
||||
void postProcessCopyPayload(const std::shared_ptr<Message>& payload);
|
||||
|
||||
|
|
Loading…
Reference in a new issue