-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check on server that the token received during a request to open a local file is indeed a valid one Signed-off-by: Matthieu Gallien <[email protected]>
- Loading branch information
Showing
3 changed files
with
49 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ | |
#include <QMessageBox> | ||
#include <QDesktopServices> | ||
#include <QGuiApplication> | ||
#include <QUrlQuery> | ||
|
||
class QSocket; | ||
|
||
|
@@ -764,8 +765,16 @@ void Application::handleEditLocally(const QUrl &url) const | |
// for a sample URL "nc://open/[email protected]:8080/Photos/lovely.jpg", QUrl::path would return "[email protected]:8080/Photos/lovely.jpg" | ||
const auto accountDisplayName = pathSplit.takeFirst(); | ||
const auto fileRemotePath = pathSplit.join('/'); | ||
const auto urlQuery = QUrlQuery{url}; | ||
|
||
FolderMan::instance()->editFileLocally(accountDisplayName, fileRemotePath); | ||
auto token = QString{}; | ||
if (urlQuery.hasQueryItem(QStringLiteral("token"))) { | ||
token = urlQuery.queryItemValue(QStringLiteral("token")); | ||
} else { | ||
qCWarning(lcApplication) << "Invalid URL for file local editing: missing token"; | ||
} | ||
|
||
FolderMan::instance()->editFileLocally(accountDisplayName, fileRemotePath, token); | ||
} | ||
|
||
QString substLang(const QString &lang) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters